C# Class MegaMan.Engine.CollisionComponent

Inheritance: MegaMan.Engine.Component
ファイルを表示 Open project: Tesserex/C--MegaMan-Engine Class Usage Examples

Public Methods

Method Description
AddBox ( MegaMan.Engine.CollisionBox box ) : void
CheckIfOneEntityHitContainProperty ( string property ) : bool

Function to check collision with solid objects which occured during game tick.

CheckIfOneEntityHitContainProperty_RealTime ( string property ) : bool

Function to check RealTime collision with solid objects. (not in game loop). CollisionWithAllEntities_RealTime Must have been called before.

CheckIfOneTileHitContainProperty ( string property ) : bool

Function to check collisions with tiles that occured during tick.

CheckIfOneTileHitContainProperty_RealTime ( string property ) : bool

Function to check RealTime collision (not in game loop). CollisionWithTiles_RealTime Must have been called before.

Clone ( ) : MegaMan.Engine.Component
CollisionWithAllEntitiesAndTiles_RealTime ( string boxName, string entity, string property, bool pushAway, bool solidOnly, bool checkTilesForCollisions, bool checkEntitiesForCollisions ) : bool

Function that checks collision with tiles and/or entities. Stops the checks as soon as one collision is found

IF MANY ENTITIES, ONLY FIRST ON IN LIST IS CHECKED

Message ( IGameMessage msg ) : void
RegisterDependencies ( MegaMan.Engine.Component component ) : void
Start ( IGameplayContainer container ) : void
Stop ( IGameplayContainer container ) : void
TouchedAt ( string myGroup, string targetGroup = null ) : bool
TouchedBy ( string group ) : bool
VerticalApproach ( RectangleF intersection, RectangleF boundBox, float vx, float vy ) : bool

Protected Methods

Method Description
Update ( ) : void

Private Methods

Method Description
BlockByIntersection ( RectangleF myBox, RectangleF targetBox, bool uponly, bool downonly ) : bool
CheckEntityCollisions ( List blockEntities, MegaMan.Engine.CollisionBox hitbox, RectangleF boundbox, bool pushAway = true, bool solidOnly = true ) : RectangleF
CheckEnvironment ( List hitSquares, MegaMan.Engine.CollisionBox hitbox, bool pushAway = true ) : void
CheckEnvironmentTile ( List hitSquares, MegaMan.Engine.CollisionBox hitbox, RectangleF hitRect, MapSquare tile, PointF &offset, bool pushAway ) : void
CheckTargetBox ( MegaMan.Engine.CollisionBox hitbox, RectangleF boundBox, IEntity entity, CollisionComponent coll, MegaMan.Engine.CollisionBox targetBox ) : RectangleF
CheckTileProperty ( TileProperties tileProperty, string property ) : bool

See returns

ClearTouch ( ) : void
CollideWith ( IEntity entity, MegaMan.Engine.CollisionBox myBox, MegaMan.Engine.CollisionBox targetBox ) : void
CollisionBoxToCheck ( string boxName, string entityId ) : List

Returns list of boxes to check. If boxName is nulled, fetch active boxes of entity, else only return boxName.

CollisionWithAllEntities_RealTime ( MegaMan.Engine.CollisionBox box, string property, bool solidOnly = true, bool pushAway = false ) : bool

See return value. Fills hitBlockEntities with all/solid (see param solidOnly) entities hit

CollisionWithTiles_RealTime ( MegaMan.Engine.CollisionBox box, string property, bool pushAway = false ) : bool

See return value. Fills hitSquaresForFunctionThatChecksCollisions with blocks hit

FloatCorrect ( RectangleF rect ) : RectangleF
HitByBoxes ( MegaMan.Engine.CollisionBox hitbox ) : IEnumerable

Get the hitboxes that the calling box would be targeted by - use for blocking

Instance_GameRender ( GameRenderEventArgs e ) : void
Loadinfo ( CollisionComponentInfo info ) : void
ReactForHitbox ( List hitSquares, HashSet hitTypes, MegaMan.Engine.CollisionBox hitbox ) : void
ReactToTileEffect ( TileProperties properties ) : void
TargetBoxes ( MegaMan.Engine.CollisionBox hitbox ) : IEnumerable

Get the hitboxes that the calling box can target

Touch ( MegaMan.Engine.CollisionBox targetbox, MegaMan.Engine.CollisionBox mybox ) : void

Method Details

AddBox() public method

public AddBox ( MegaMan.Engine.CollisionBox box ) : void
box MegaMan.Engine.CollisionBox
return void

CheckIfOneEntityHitContainProperty() public method

Function to check collision with solid objects which occured during game tick.
public CheckIfOneEntityHitContainProperty ( string property ) : bool
property string
return bool

CheckIfOneEntityHitContainProperty_RealTime() public method

Function to check RealTime collision with solid objects. (not in game loop). CollisionWithAllEntities_RealTime Must have been called before.
public CheckIfOneEntityHitContainProperty_RealTime ( string property ) : bool
property string
return bool

CheckIfOneTileHitContainProperty() public method

Function to check collisions with tiles that occured during tick.
public CheckIfOneTileHitContainProperty ( string property ) : bool
property string
return bool

CheckIfOneTileHitContainProperty_RealTime() public method

Function to check RealTime collision (not in game loop). CollisionWithTiles_RealTime Must have been called before.
public CheckIfOneTileHitContainProperty_RealTime ( string property ) : bool
property string
return bool

Clone() public method

public Clone ( ) : MegaMan.Engine.Component
return MegaMan.Engine.Component

CollisionWithAllEntitiesAndTiles_RealTime() public method

Function that checks collision with tiles and/or entities. Stops the checks as soon as one collision is found
IF MANY ENTITIES, ONLY FIRST ON IN LIST IS CHECKED
public CollisionWithAllEntitiesAndTiles_RealTime ( string boxName, string entity, string property, bool pushAway, bool solidOnly, bool checkTilesForCollisions, bool checkEntitiesForCollisions ) : bool
boxName string If null, pick every active box of entity picked
entity string If null, current entity
property string Example: Blocking
pushAway bool If a collision is found, need to push entity away?
solidOnly bool Applies to entities. Check only solid ones?
checkTilesForCollisions bool
checkEntitiesForCollisions bool
return bool

Message() public method

public Message ( IGameMessage msg ) : void
msg IGameMessage
return void

RegisterDependencies() public method

public RegisterDependencies ( MegaMan.Engine.Component component ) : void
component MegaMan.Engine.Component
return void

Start() public method

public Start ( IGameplayContainer container ) : void
container IGameplayContainer
return void

Stop() public method

public Stop ( IGameplayContainer container ) : void
container IGameplayContainer
return void

TouchedAt() public method

public TouchedAt ( string myGroup, string targetGroup = null ) : bool
myGroup string
targetGroup string
return bool

TouchedBy() public method

public TouchedBy ( string group ) : bool
group string
return bool

Update() protected method

protected Update ( ) : void
return void

VerticalApproach() public static method

public static VerticalApproach ( RectangleF intersection, RectangleF boundBox, float vx, float vy ) : bool
intersection RectangleF
boundBox RectangleF
vx float
vy float
return bool