C# Class GameEngine.GameObjects.Entity

An abstract Entity class that should be inherited by objects which are to be visible within the game world. Any map objects, NPCs, particles or playable characters should inherit from this class in order to be used by the game engine.
Inheritance: ILoadable
Mostra file Open project: MichaelAquilina/Some-2D-RPG Class Usage Examples

Public Properties

Property Type Description
Pos Vector2

Private Properties

Property Type Description
Construct void

Public Methods

Method Description
Entity ( ) : System
Entity ( float x, float y, float scaleX = 1, float scaleY = 1, bool visible = true ) : System
GetDebugInfo ( ) : string

Overridable method whose result is used to display entity debug information by the TeeEngine in its draw method when 'ShowEntityDebugInfo' is set to true in the DrawingOptions. By Default, the result of this method will be the same as the ToString method.

GetPxBoundingBox ( GameTime gameTime ) : Rectangle

Gets the bounding box for this entity at the specified GameTime and using the specified Tile Width and Height (In Pixels). The result of this method will be returned in pixel units and will change from one GameTime instance to another depending on the contents of the entities Drawables. If no drawables are found in the entity, then a rectangle with 0 width and 0 height will be returned.

GetPxBoundingBox ( GameTime gameTime, string group ) : Rectangle

Gets the bounding box for this entity at the specified GameTime and using the specified Tile Width and Height (In Pixels). The result of this method will be returned in pixel units and will change from one GameTime instance to another depending on the contents of the entities Drawables. If no drawables are found in the entity, then a rectangle with 0 width and 0 height will be returned. An optional group parameter may be passed to only calculate the bounding area for a specific group of drawable objects. Passing null to group will test for all groups.

IntersectsWith ( Entity entity1, string entity1Group, Entity entity2, string entity2Group, GameTime gameTime ) : bool

Helper method that wraps the static IntersectsWith Entity method. Assumes the state to check is the current drawable state.

IntersectsWith ( Entity entity1, string entity1State, string entity1Group, Entity entity2, string entity2State, string entity2Group, GameTime gameTime ) : bool

Checks if Two Entities are intersecting each other assuming the specified states, gameTime and group filter. This check is actually rather ineffecient. O(n^2) time complexity. In reality though, we would be smart about what to compare - hence the group and state filters. The number of comparasins between drawables should be kept to a minimum in order to maintain performance.

IntersectsWith ( Entity entity, string entityState, string entityGroup, FRectangle bounds, GameTime gameTime ) : bool
LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
PostCreate ( GameTime gameTime, TeeEngine engine ) : void

Called AFTER the entity is added to the engines entity list. The entity will be garuanteed to have a valid CurrentBoundingBox value and have a place in the QuadTree.

PostDestroy ( GameTime gameTime, TeeEngine engine ) : void

Called AFTER the entity has been removed from the engines entity list.

PreCreate ( GameTime gameTime, TeeEngine engine ) : bool

Called BEFORE the entity is added to the engines entity list. The result of the PreCreate method determines if the entity will be added or not.

PreDestroy ( GameTime gameTime, TeeEngine engine ) : bool

Called BEFORE the entity has been removed from the engines entity list. The result of the PreDestroy method determines if the entity will be removed or not.

ToString ( ) : string
Update ( GameTime gameTime, TeeEngine engine ) : void

Private Methods

Method Description
Construct ( float x, float y, float scaleX, float scaleY, bool visible ) : void

Method Details

Entity() public method

public Entity ( ) : System
return System

Entity() public method

public Entity ( float x, float y, float scaleX = 1, float scaleY = 1, bool visible = true ) : System
x float
y float
scaleX float
scaleY float
visible bool
return System

GetDebugInfo() public method

Overridable method whose result is used to display entity debug information by the TeeEngine in its draw method when 'ShowEntityDebugInfo' is set to true in the DrawingOptions. By Default, the result of this method will be the same as the ToString method.
public GetDebugInfo ( ) : string
return string

GetPxBoundingBox() public method

Gets the bounding box for this entity at the specified GameTime and using the specified Tile Width and Height (In Pixels). The result of this method will be returned in pixel units and will change from one GameTime instance to another depending on the contents of the entities Drawables. If no drawables are found in the entity, then a rectangle with 0 width and 0 height will be returned.
public GetPxBoundingBox ( GameTime gameTime ) : Rectangle
gameTime Microsoft.Xna.Framework.GameTime
return Microsoft.Xna.Framework.Rectangle

GetPxBoundingBox() public method

Gets the bounding box for this entity at the specified GameTime and using the specified Tile Width and Height (In Pixels). The result of this method will be returned in pixel units and will change from one GameTime instance to another depending on the contents of the entities Drawables. If no drawables are found in the entity, then a rectangle with 0 width and 0 height will be returned. An optional group parameter may be passed to only calculate the bounding area for a specific group of drawable objects. Passing null to group will test for all groups.
public GetPxBoundingBox ( GameTime gameTime, string group ) : Rectangle
gameTime Microsoft.Xna.Framework.GameTime The Current GameTime.
group string Optional string value that specifies the groups to include in BB calculations.
return Microsoft.Xna.Framework.Rectangle

IntersectsWith() public static method

Helper method that wraps the static IntersectsWith Entity method. Assumes the state to check is the current drawable state.
public static IntersectsWith ( Entity entity1, string entity1Group, Entity entity2, string entity2Group, GameTime gameTime ) : bool
entity1 Entity
entity1Group string
entity2 Entity
entity2Group string
gameTime Microsoft.Xna.Framework.GameTime
return bool

IntersectsWith() public static method

Checks if Two Entities are intersecting each other assuming the specified states, gameTime and group filter. This check is actually rather ineffecient. O(n^2) time complexity. In reality though, we would be smart about what to compare - hence the group and state filters. The number of comparasins between drawables should be kept to a minimum in order to maintain performance.
public static IntersectsWith ( Entity entity1, string entity1State, string entity1Group, Entity entity2, string entity2State, string entity2Group, GameTime gameTime ) : bool
entity1 Entity
entity1State string
entity1Group string
entity2 Entity
entity2State string
entity2Group string
gameTime Microsoft.Xna.Framework.GameTime
return bool

IntersectsWith() public static method

public static IntersectsWith ( Entity entity, string entityState, string entityGroup, FRectangle bounds, GameTime gameTime ) : bool
entity Entity
entityState string
entityGroup string
bounds GameEngine.Drawing.FRectangle
gameTime Microsoft.Xna.Framework.GameTime
return bool

LoadContent() public method

public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
return void

PostCreate() public method

Called AFTER the entity is added to the engines entity list. The entity will be garuanteed to have a valid CurrentBoundingBox value and have a place in the QuadTree.
public PostCreate ( GameTime gameTime, TeeEngine engine ) : void
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
return void

PostDestroy() public method

Called AFTER the entity has been removed from the engines entity list.
public PostDestroy ( GameTime gameTime, TeeEngine engine ) : void
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
return void

PreCreate() public method

Called BEFORE the entity is added to the engines entity list. The result of the PreCreate method determines if the entity will be added or not.
public PreCreate ( GameTime gameTime, TeeEngine engine ) : bool
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
return bool

PreDestroy() public method

Called BEFORE the entity has been removed from the engines entity list. The result of the PreDestroy method determines if the entity will be removed or not.
public PreDestroy ( GameTime gameTime, TeeEngine engine ) : bool
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
return bool

ToString() public method

public ToString ( ) : string
return string

Update() public method

public Update ( GameTime gameTime, TeeEngine engine ) : void
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
return void

Property Details

Pos public_oe property

Entities X and Y position on the Map.
public Vector2 Pos
return Vector2