C# Class SGDE.Physics.PhysicsPharaoh

Central manager for game physics.
Datei anzeigen Open project: sgdc/sgdc-old Class Usage Examples

Public Methods

Method Description
AddCollisionUnit ( CollisionUnit unit ) : void

Add a CollisionUnit to the Pharaoh's control.

AddPhysicsBaby ( PhysicsBaby physBaby ) : void

Add a PhysicsBaby to be managed by the Pharaoh.

DrawCollisionGrid ( Microsoft.Xna.Framework.Graphics.Texture2D gridTexture ) : void

Helper function to draw the currently active physics grid.

GetGravity ( ) : Vector2

Get the game gravity.

GetInstance ( ) : PhysicsPharaoh

Get the PhysicsPharaoh singleton.

Initialize ( Vector2 worldSize, Vector2 collisionCellSize ) : void

Initialize the PhysicsPharaoh.

RemoveCollisionUnit ( CollisionUnit unit ) : void

Remove a CollisionUnit from the Pharaoh's control.

RemovePhysicsBaby ( PhysicsBaby physBaby ) : void

Remove a PhysicsBaby from the Pharaoh's control.

SetGravity ( Vector2 gravity ) : void

Set the game gravity for all physics babies.

Update ( GameTime gameTime ) : void

Update the game's physics system.

Private Methods

Method Description
PhysicsPharaoh ( ) : System

Method Details

AddCollisionUnit() public method

Add a CollisionUnit to the Pharaoh's control.
public AddCollisionUnit ( CollisionUnit unit ) : void
unit SGDE.Physics.Collision.CollisionUnit The CollisionUnit to add.
return void

AddPhysicsBaby() public method

Add a PhysicsBaby to be managed by the Pharaoh.
public AddPhysicsBaby ( PhysicsBaby physBaby ) : void
physBaby PhysicsBaby The PhysicsBaby to add.
return void

DrawCollisionGrid() public method

Helper function to draw the currently active physics grid.
public DrawCollisionGrid ( Microsoft.Xna.Framework.Graphics.Texture2D gridTexture ) : void
gridTexture Microsoft.Xna.Framework.Graphics.Texture2D The texture that represents a cell within the physics grid.
return void

GetGravity() public method

Get the game gravity.
public GetGravity ( ) : Vector2
return Vector2

GetInstance() public static method

Get the PhysicsPharaoh singleton.
public static GetInstance ( ) : PhysicsPharaoh
return PhysicsPharaoh

Initialize() public method

Initialize the PhysicsPharaoh.
public Initialize ( Vector2 worldSize, Vector2 collisionCellSize ) : void
worldSize Vector2 The size of the physical map.
collisionCellSize Vector2 The size of a grid within the physical map.
return void

RemoveCollisionUnit() public method

Remove a CollisionUnit from the Pharaoh's control.
public RemoveCollisionUnit ( CollisionUnit unit ) : void
unit SGDE.Physics.Collision.CollisionUnit the CollisionUnit to remove.
return void

RemovePhysicsBaby() public method

Remove a PhysicsBaby from the Pharaoh's control.
public RemovePhysicsBaby ( PhysicsBaby physBaby ) : void
physBaby PhysicsBaby The PhysicsBaby to free.
return void

SetGravity() public method

Set the game gravity for all physics babies.
public SetGravity ( Vector2 gravity ) : void
gravity Vector2 Gravity to affect all units.
return void

Update() public method

Update the game's physics system.
public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The current GameTime.
return void