C# Class WarTornLands.Infrastructure.CollisionManager

Mostra file Open project: floAr/WarTornLands

Public Methods

Method Description
Collide ( CircleCollisionShape s1, CircleCollisionShape s2 ) : bool
Collide ( CircleCollisionShape s1, CompoundCollisionShape s2 ) : bool
Collide ( CompoundCollisionShape s1, CompoundCollisionShape s2 ) : bool
Collide ( ICollisionShape s1, ICollisionShape s2 ) : bool
Collide ( RectangleCollisionShape s1, CircleCollisionShape s2 ) : bool
Collide ( RectangleCollisionShape s1, CompoundCollisionShape s2 ) : bool
Collide ( RectangleCollisionShape s1, RectangleCollisionShape s2 ) : bool
IsAccessible ( Rectangle rect, bool testTiles, Entity source = null ) : bool

Check whether a rectangle is accessible or not.

OffsetRectangle ( Rectangle rect, Vector2 offset ) : Rectangle

Offset a rectangle by a given vector using the ceiling of the absolute vector values. The original rectangle is not modified, since the rect is passed by value.

TryMove ( Entity source, Vector2 moveVector, bool slide = true ) : Vector2

Tries to move an entity by a given move vector. Calls Entity.Collide functions of both the source and the entities it collides with along the way. The resulting move vector needs to be applied manually by the calling function!

Private Methods

Method Description
CollisionManager ( ) : System

Method Details

Collide() public static method

public static Collide ( CircleCollisionShape s1, CircleCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.CircleCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.CircleCollisionShape
return bool

Collide() public static method

public static Collide ( CircleCollisionShape s1, CompoundCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.CircleCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.CompoundCollisionShape
return bool

Collide() public static method

public static Collide ( CompoundCollisionShape s1, CompoundCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.CompoundCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.CompoundCollisionShape
return bool

Collide() public static method

public static Collide ( ICollisionShape s1, ICollisionShape s2 ) : bool
s1 ICollisionShape
s2 ICollisionShape
return bool

Collide() public static method

public static Collide ( RectangleCollisionShape s1, CircleCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.RectangleCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.CircleCollisionShape
return bool

Collide() public static method

public static Collide ( RectangleCollisionShape s1, CompoundCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.RectangleCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.CompoundCollisionShape
return bool

Collide() public static method

public static Collide ( RectangleCollisionShape s1, RectangleCollisionShape s2 ) : bool
s1 WarTornLands.Entities.Modules.Collide.CollisionShape.RectangleCollisionShape
s2 WarTornLands.Entities.Modules.Collide.CollisionShape.RectangleCollisionShape
return bool

IsAccessible() public method

Check whether a rectangle is accessible or not.
public IsAccessible ( Rectangle rect, bool testTiles, Entity source = null ) : bool
rect Microsoft.Xna.Framework.Rectangle Rectangle to be tested.
testTiles bool Whether tile collision should be tested.
source Entity Entity that's colliding, e.g. if some thing's collide only with the player.
return bool

OffsetRectangle() public method

Offset a rectangle by a given vector using the ceiling of the absolute vector values. The original rectangle is not modified, since the rect is passed by value.
public OffsetRectangle ( Rectangle rect, Vector2 offset ) : Rectangle
rect Microsoft.Xna.Framework.Rectangle Rectangle to be modified.
offset Vector2 Offset vector, absolute value rounded up.
return Microsoft.Xna.Framework.Rectangle

TryMove() public method

Tries to move an entity by a given move vector. Calls Entity.Collide functions of both the source and the entities it collides with along the way. The resulting move vector needs to be applied manually by the calling function!
public TryMove ( Entity source, Vector2 moveVector, bool slide = true ) : Vector2
source Entity Entity that is to be moved.
moveVector Vector2 Vector by which the entity is to be moved.
slide bool
return Vector2