C# Класс 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.
Наследование: ILoadable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Pos Vector2

Private Properties

Свойство Тип Описание
Construct void

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
Construct ( float x, float y, float scaleX, float scaleY, bool visible ) : void

Описание методов

Entity() публичный Метод

public Entity ( ) : System
Результат System

Entity() публичный Метод

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
Результат System

GetDebugInfo() публичный Метод

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
Результат string

GetPxBoundingBox() публичный Метод

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
Результат Microsoft.Xna.Framework.Rectangle

GetPxBoundingBox() публичный Метод

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.
Результат Microsoft.Xna.Framework.Rectangle

IntersectsWith() публичный статический Метод

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
Результат bool

IntersectsWith() публичный статический Метод

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
Результат bool

IntersectsWith() публичный статический Метод

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
Результат bool

LoadContent() публичный Метод

public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
Результат void

PostCreate() публичный Метод

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
Результат void

PostDestroy() публичный Метод

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
Результат void

PreCreate() публичный Метод

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
Результат bool

PreDestroy() публичный Метод

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
Результат bool

ToString() публичный Метод

public ToString ( ) : string
Результат string

Update() публичный Метод

public Update ( GameTime gameTime, TeeEngine engine ) : void
gameTime Microsoft.Xna.Framework.GameTime
engine TeeEngine
Результат void

Описание свойств

Pos публичное свойство

Entities X and Y position on the Map.
public Vector2 Pos
Результат Vector2