C# Class Manic_Shooter.Classes.Sprite

Inheritance: IRenderable, ISprite
Exibir arquivo Open project: TheGameDevelopmentClub/Manic-Shooter

Protected Properties

Property Type Description
_drawHitbox bool
_hurtFlashing bool
_rotation float
centerPosition Vector2
hitboxHorizRatio float
hitboxRadius float
hitboxVertRatio float
randomDropChance int
texturebox Microsoft.Xna.Framework.Rectangle

Public Methods

Method Description
ApplyVelocity ( System.TimeSpan elapsedTime ) : void

Applies the current velocity to the sprite given the time elapsed since the last update call.

Destroy ( ) : void
Hide ( ) : void

Makes the sprite invisible

IsOffScreen ( ) : bool

Used to determine if the sprite is offscreen (used for de-activation)

Render ( Microsoft spriteBatch ) : void

Renders the Sprite with it's current texture

ScaleSize ( decimal scale ) : void
SetSize ( Vector2 newSize ) : void
Show ( ) : void

Makes the sprite visible

Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, int health = 1 ) : System
Update ( GameTime gameTime ) : void

Used to update the sprite for changing position or taking actions. This is best called in the Update part of the game loop

Protected Methods

Method Description
MoveBy ( Vector2 deltaVector ) : void
MoveBy ( float deltaX, float deltaY ) : void
MoveTo ( Vector2 position ) : void
MoveTo ( float x, float y ) : void
SetVelocity ( Vector2 newVelocity ) : void
SetVelocity ( Vector2 destination, int speed ) : void

Method Details

ApplyVelocity() public method

Applies the current velocity to the sprite given the time elapsed since the last update call.
public ApplyVelocity ( System.TimeSpan elapsedTime ) : void
elapsedTime System.TimeSpan Time elapsed since the last update
return void

Destroy() public method

public Destroy ( ) : void
return void

Hide() public method

Makes the sprite invisible
public Hide ( ) : void
return void

IsOffScreen() public method

Used to determine if the sprite is offscreen (used for de-activation)
public IsOffScreen ( ) : bool
return bool

MoveBy() protected method

protected MoveBy ( Vector2 deltaVector ) : void
deltaVector Vector2
return void

MoveBy() protected method

protected MoveBy ( float deltaX, float deltaY ) : void
deltaX float
deltaY float
return void

MoveTo() protected method

protected MoveTo ( Vector2 position ) : void
position Vector2
return void

MoveTo() protected method

protected MoveTo ( float x, float y ) : void
x float
y float
return void

Render() public method

Renders the Sprite with it's current texture
public Render ( Microsoft spriteBatch ) : void
spriteBatch Microsoft The spritebatch to use for rendering
return void

ScaleSize() public method

public ScaleSize ( decimal scale ) : void
scale decimal
return void

SetSize() public method

public SetSize ( Vector2 newSize ) : void
newSize Vector2
return void

SetVelocity() protected method

protected SetVelocity ( Vector2 newVelocity ) : void
newVelocity Vector2
return void

SetVelocity() protected method

protected SetVelocity ( Vector2 destination, int speed ) : void
destination Vector2
speed int
return void

Show() public method

Makes the sprite visible
public Show ( ) : void
return void

Sprite() public method

public Sprite ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Vector2 position, int health = 1 ) : System
texture Microsoft.Xna.Framework.Graphics.Texture2D
position Vector2
health int
return System

Update() public method

Used to update the sprite for changing position or taking actions. This is best called in the Update part of the game loop
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The amount of time elapsed since the last call
return void

Property Details

_drawHitbox protected_oe property

protected bool _drawHitbox
return bool

_hurtFlashing protected_oe property

protected bool _hurtFlashing
return bool

_rotation protected_oe property

protected float _rotation
return float

centerPosition protected_oe property

protected Vector2 centerPosition
return Vector2

hitboxHorizRatio protected_oe property

protected float hitboxHorizRatio
return float

hitboxRadius protected_oe property

protected float hitboxRadius
return float

hitboxVertRatio protected_oe property

protected float hitboxVertRatio
return float

randomDropChance protected_oe property

protected int randomDropChance
return int

texturebox protected_oe property

protected Rectangle,Microsoft.Xna.Framework texturebox
return Microsoft.Xna.Framework.Rectangle