C# Class SGDE.Entity

Base Class representative of any onscreen drawable that appears in a scene
Inheritance: SceneNode, IUpdateable
Exibir arquivo Open project: sgdc/sgdc-old

Protected Properties

Property Type Description
id uint
image Sprite
mCollisionUnit SGDE.Physics.Collision.CollisionUnit
mPhysBaby SGDE.Physics.PhysicsBaby

Public Methods

Method Description
CollisionChange ( ) : void

Collision change event. This is usually called when an Entitiy collides with this Entity.

CompareID ( Entity e ) : bool

Compare this ID's Entity with another Entity to determine if they are the same.

CopyTo ( Entity &ent ) : void

Copy this Entity to another entity. If overriden then the base.CopyTo call must be the first line of code.

Draw ( GameTime gameTime ) : void

Draws the entity to the screen

EnablePhysics ( bool bPhysics, bool bCollision ) : void

Enable physics on this Entity.

Entity ( ) : System
Entity ( Vector2 position ) : System

Constructs a new entity in the scene

Entity ( float x, float y ) : System

Constructs a new entity in the scene

GetCollisionUnit ( ) : CollisionUnit

Get the collision unit for this Entity

GetID ( ) : uint

Get the ID of this Entity.

GetPhysicsBaby ( ) : PhysicsBaby

Get the PhysicsBaby for this Entity.

GetVelocity ( ) : Vector2

Get this Entity's velocity. This is a helper function that is equivilant to GetPhysicsBaby().GetVelocity();.

SetCollisionUnit ( CollisionUnit unit ) : void

Set the collision unit for this Entity.

SetVelocity ( Vector2 velocity ) : void

Set this Entity's velocity. This is a helper function that is equivilant to GetPhysicsBaby().SetVelocity(velocity);.

SetVelocity ( float x, float y ) : void

Set this Entity's velocity. This is a helper function that is equivilant to SetVelocity(new Vector2(x, y));.

Update ( GameTime gameTime ) : void

Called once during each step taken by the engine

Protected Methods

Method Description
SetUpCollision ( ) : void

Set up the collision unit for this Entity.

Private Methods

Method Description
InSetUpCollision ( ) : void
SetColor ( Color backColor ) : void

Method Details

CollisionChange() public method

Collision change event. This is usually called when an Entitiy collides with this Entity.
public CollisionChange ( ) : void
return void

CompareID() public method

Compare this ID's Entity with another Entity to determine if they are the same.
public CompareID ( Entity e ) : bool
e Entity The other Entity to compare IDs with.
return bool

CopyTo() public method

Copy this Entity to another entity. If overriden then the base.CopyTo call must be the first line of code.
public CopyTo ( Entity &ent ) : void
ent Entity The entity to copy to.
return void

Draw() public method

Draws the entity to the screen
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

EnablePhysics() public method

Enable physics on this Entity.
public EnablePhysics ( bool bPhysics, bool bCollision ) : void
bPhysics bool true if physics should be enabled for this Entity, false if it should be disabled.
bCollision bool true collisions should be enabled for this Entity, false if it should be disabled.
return void

Entity() public method

public Entity ( ) : System
return System

Entity() public method

Constructs a new entity in the scene
public Entity ( Vector2 position ) : System
position Vector2 Coordinates
return System

Entity() public method

Constructs a new entity in the scene
public Entity ( float x, float y ) : System
x float X coordinate
y float Y coordinate
return System

GetCollisionUnit() public method

Get the collision unit for this Entity
public GetCollisionUnit ( ) : CollisionUnit
return SGDE.Physics.Collision.CollisionUnit

GetID() public method

Get the ID of this Entity.
public GetID ( ) : uint
return uint

GetPhysicsBaby() public method

Get the PhysicsBaby for this Entity.
public GetPhysicsBaby ( ) : PhysicsBaby
return SGDE.Physics.PhysicsBaby

GetVelocity() public method

Get this Entity's velocity. This is a helper function that is equivilant to GetPhysicsBaby().GetVelocity();.
public GetVelocity ( ) : Vector2
return Vector2

SetCollisionUnit() public method

Set the collision unit for this Entity.
public SetCollisionUnit ( CollisionUnit unit ) : void
unit SGDE.Physics.Collision.CollisionUnit The collision unit to set for this Entity.
return void

SetUpCollision() protected method

Set up the collision unit for this Entity.
protected SetUpCollision ( ) : void
return void

SetVelocity() public method

Set this Entity's velocity. This is a helper function that is equivilant to GetPhysicsBaby().SetVelocity(velocity);.
public SetVelocity ( Vector2 velocity ) : void
velocity Vector2 The velocity to set this Entity's velocity to.
return void

SetVelocity() public method

Set this Entity's velocity. This is a helper function that is equivilant to SetVelocity(new Vector2(x, y));.
public SetVelocity ( float x, float y ) : void
x float The horizontal velocity of for this Entity.
y float The veritcal velocity of for this Entity.
return void

Update() public method

Called once during each step taken by the engine
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The current game time
return void

Property Details

id protected_oe property

ID for Checking the type of an Entity
protected uint id
return uint

image protected_oe property

Sprite which is drawn to represent the entity
protected Sprite image
return Sprite

mCollisionUnit protected_oe property

Contains the collision logic for the entity
protected CollisionUnit,SGDE.Physics.Collision mCollisionUnit
return SGDE.Physics.Collision.CollisionUnit

mPhysBaby protected_oe property

Contains the general collision data for the entity.
protected PhysicsBaby,SGDE.Physics mPhysBaby
return SGDE.Physics.PhysicsBaby