Class PhysicsBehavior
Represents an abstract class for defining physics behavior in the game.
Inheritance
PhysicsBehavior
Inherited Members
Namespace: Genesis.Physics
Assembly: Genesis.dll
Syntax
public abstract class PhysicsBehavior : IGameBehavior
Constructors
PhysicsBehavior()
Declaration
protected PhysicsBehavior()
Methods
Collide(Scene, Game, GameElement)
Handles the collision event, invoking the OnCollide event if subscribed.
Declaration
public virtual void Collide(Scene scene, Game game, GameElement collisionObject)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The scene where the collision occurred |
| Game | game | The game associated with the collision |
| GameElement | collisionObject | The collision object involved in the event |
GetPhysicsObject()
Gets the physics object associated with this behavior.
Declaration
public abstract object GetPhysicsObject()
Returns
| Type | Description |
|---|---|
| object | The physics object |
GetPhysicsObject<T>()
Gets the physics object associated with this behavior, cast to type T.
Declaration
public abstract T GetPhysicsObject<T>()
Returns
| Type | Description |
|---|---|
| T | The physics object cast to type T |
Type Parameters
| Name | Description |
|---|---|
| T | Type to cast the physics object to |
Events
OnCollide
Event triggered when a collision occurs.
Declaration
public event PhysicsBehaviorEvent OnCollide
Event Type
| Type | Description |
|---|---|
| PhysicsBehaviorEvent |