C# Class PantheonPrototype.Entity

The Entity defines an object within the game. It has physical presence in the game as a Sprite and can collide with other Entities.
Exibir arquivo Open project: Bacon41/PantheonPrototype

Protected Properties

Property Type Description
actionPoint Vector2
boundingBox Microsoft.Xna.Framework.Rectangle
characteristics List
currentState string
drawingBox Microsoft.Xna.Framework.Rectangle
prevLocation Vector2
sprite Sprite
toDestroy bool

Public Methods

Method Description
Draw ( SpriteBatch canvas ) : void

Draws the entity to its current location.

Entity ( ) : System

A no parameter entity for conveniences sake.

Entity ( Vector2 location, Rectangle drawBox, Rectangle boundingBox ) : System

Constructs a basic entity. This is a more accessible constructor. In general, use this constructor when making new entities.

Entity ( float x, float y, Rectangle drawBox, Rectangle boundingBox ) : System

Constructs a basic entity. This is the technical constructor. Unless you understand exactly how the entity is stored, I recommend using the other constructor.

Load ( Microsoft.Xna.Framework.Content.ContentManager contentManager ) : void

Loads any assets this particular entity needs.

Update ( GameTime gameTime, Pantheon gameReference ) : void

Updates the entity... yeah.

collidesWith ( Entity other ) : bool

Detects collisions between another entity. Uses the rectangle defining sprite to detect collisions.

Method Details

Draw() public method

Draws the entity to its current location.
public Draw ( SpriteBatch canvas ) : void
canvas Microsoft.Xna.Framework.Graphics.SpriteBatch An initialized sprite batch to draw the sprite upon.
return void

Entity() public method

A no parameter entity for conveniences sake.
public Entity ( ) : System
return System

Entity() public method

Constructs a basic entity. This is a more accessible constructor. In general, use this constructor when making new entities.
public Entity ( Vector2 location, Rectangle drawBox, Rectangle boundingBox ) : System
location Vector2 The location of the entity relative to global space. Note that the reference point of the entity is the center of the bounding box.
drawBox Microsoft.Xna.Framework.Rectangle The box to which the sprite will be drawn. Only the width and height will be used.
boundingBox Microsoft.Xna.Framework.Rectangle The bounding box of the entity relative to the upper right hand corner of the entity.
return System

Entity() public method

Constructs a basic entity. This is the technical constructor. Unless you understand exactly how the entity is stored, I recommend using the other constructor.
public Entity ( float x, float y, Rectangle drawBox, Rectangle boundingBox ) : System
x float The x coordinate of the action point.
y float The y coordinate of the action point.
drawBox Microsoft.Xna.Framework.Rectangle The draw box defines the area to which the sprite /// is drawn relative to the upper left hand corner..
boundingBox Microsoft.Xna.Framework.Rectangle The bounding box relative to the action point.
return System

Load() public method

Loads any assets this particular entity needs.
public Load ( Microsoft.Xna.Framework.Content.ContentManager contentManager ) : void
contentManager Microsoft.Xna.Framework.Content.ContentManager
return void

Update() public method

Updates the entity... yeah.
public Update ( GameTime gameTime, Pantheon gameReference ) : void
gameTime Microsoft.Xna.Framework.GameTime Even has the option for frame rate, pretty cool eh?
gameReference Pantheon The ugly global game reference of doom.
return void

collidesWith() public method

Detects collisions between another entity. Uses the rectangle defining sprite to detect collisions.
public collidesWith ( Entity other ) : bool
other Entity The entity to detect collision with.
return bool

Property Details

actionPoint protected_oe property

This is the point around which the sprite is drawn. It functions as the center of the entity and is automatically set to the center of the bounding box.
protected Vector2 actionPoint
return Vector2

boundingBox protected_oe property

Puppies!!! No puppies, actually fruit. Also, this is the bounding box.
protected Rectangle,Microsoft.Xna.Framework boundingBox
return Microsoft.Xna.Framework.Rectangle

characteristics protected_oe property

A list of characteristics which determine what an entity does on collision. Basically, this is a list that determines which collision types to check.
protected List characteristics
return List

currentState protected_oe property

A string representing the current state.
protected string currentState
return string

drawingBox protected_oe property

The box to which the sprite will be drawn.
protected Rectangle,Microsoft.Xna.Framework drawingBox
return Microsoft.Xna.Framework.Rectangle

prevLocation protected_oe property

protected Vector2 prevLocation
return Vector2

sprite protected_oe property

The visual representation of the entity.
protected Sprite sprite
return Sprite

toDestroy protected_oe property

This tells the level that it is dead, and needs to be removed.
protected bool toDestroy
return bool