C# Class MrGravity.Game_Objects.Physics_Objects.PhysicsObject

Represents an object that has rules based on physics
Inheritance: GameObject
显示文件 Open project: DizWARE/Mr-Gravity Class Usage Examples

Protected Properties

Property Type Description
MEnvironment PhysicsEnvironment
MMass float

Public Methods

Method Description
AddForce ( Vector2 force ) : void

Adds an additional force to the physics object

ApplyImmediateForce ( Vector2 force ) : void

Applies the force immediately. This will not be permanant

ChangeGravityForceDirection ( GravityDirections direction ) : void

Reorient gravity in the given direction

Equals ( otherObject otherObject ) : System
FixForBounds ( int width, int height, bool isFixed ) : void

TEMP METHOD - WILL GIVE THE PLAYER THE ABILITY TO FALL FROM ONE END OF THE SCREEN TO THE OTHER

GetCollitionDepth ( GameObject otherObject ) : Vector2

finds how deep they are intersecting (That is what she said!)

HandleCollideBoxAndBox ( GameObject otherObject ) : int

Handles collision for two boxes (this, and other)

HandleCollideCircleAndBox ( GameObject otherObject ) : int

Handles collision for circle and Box (circle =this)

HandleCollideCircleAndCircle ( GameObject otherObject ) : int

Handles collision for circle and circle

HandleCollisionList ( List objList ) : void

Allows for only one collision to be done. Whichever object this is colliding with deepest, handle only that collision.

HandleCollisions ( GameObject obj ) : bool

Decides on the collision detection method for this and the given object

IsCollidingBoxAndBox ( GameObject otherObject ) : bool

Returns true if the physics objects are colliding with each other (only good for 2 boxes)

PhysicsObject ( Microsoft.Xna.Framework.Content.ContentManager content, PhysicsEnvironment &environment, float friction, EntityInfo entity ) : System

Constructs a PhysicsObject; Loads the required info from the content pipeline, and defines its size and location

Method Details

AddForce() public method

Adds an additional force to the physics object
public AddForce ( Vector2 force ) : void
force Vector2 Force to be added
return void

ApplyImmediateForce() public method

Applies the force immediately. This will not be permanant
public ApplyImmediateForce ( Vector2 force ) : void
force Vector2 Force to apply
return void

ChangeGravityForceDirection() public method

Reorient gravity in the given direction
public ChangeGravityForceDirection ( GravityDirections direction ) : void
direction GravityDirections Direction to enforce gravity on
return void

Equals() public method

public Equals ( otherObject otherObject ) : System
otherObject otherObject
return System

FixForBounds() public method

TEMP METHOD - WILL GIVE THE PLAYER THE ABILITY TO FALL FROM ONE END OF THE SCREEN TO THE OTHER
public FixForBounds ( int width, int height, bool isFixed ) : void
width int
height int
isFixed bool
return void

GetCollitionDepth() public method

finds how deep they are intersecting (That is what she said!)
public GetCollitionDepth ( GameObject otherObject ) : Vector2
otherObject GameObject
return Vector2

HandleCollideBoxAndBox() public method

Handles collision for two boxes (this, and other)
public HandleCollideBoxAndBox ( GameObject otherObject ) : int
otherObject GameObject object to do collision on(box)
return int

HandleCollideCircleAndBox() public method

Handles collision for circle and Box (circle =this)
public HandleCollideCircleAndBox ( GameObject otherObject ) : int
otherObject GameObject object to do collision on(box)
return int

HandleCollideCircleAndCircle() public method

Handles collision for circle and circle
public HandleCollideCircleAndCircle ( GameObject otherObject ) : int
otherObject GameObject object to do collision on(circle)
return int

HandleCollisionList() public method

Allows for only one collision to be done. Whichever object this is colliding with deepest, handle only that collision.
public HandleCollisionList ( List objList ) : void
objList List list of objects that this is colliding with
return void

HandleCollisions() public method

Decides on the collision detection method for this and the given object
public HandleCollisions ( GameObject obj ) : bool
obj GameObject object we are testing
return bool

IsCollidingBoxAndBox() public method

Returns true if the physics objects are colliding with each other (only good for 2 boxes)
public IsCollidingBoxAndBox ( GameObject otherObject ) : bool
otherObject GameObject The other object to test against
return bool

PhysicsObject() public method

Constructs a PhysicsObject; Loads the required info from the content pipeline, and defines its size and location
public PhysicsObject ( Microsoft.Xna.Framework.Content.ContentManager content, PhysicsEnvironment &environment, float friction, EntityInfo entity ) : System
content Microsoft.Xna.Framework.Content.ContentManager Content pipeline
environment PhysicsEnvironment
friction float
entity MrGravity.Import_Code.EntityInfo
return System

Property Details

MEnvironment protected_oe property

protected PhysicsEnvironment MEnvironment
return PhysicsEnvironment

MMass protected_oe property

protected float MMass
return float