Bricklayer.Client.Entities.Player.TileIntersectsPlayer C# (CSharp) Method

TileIntersectsPlayer() public static method

Checks for tile intersections/collision depth between a player and a tile
public static TileIntersectsPlayer ( Rectangle player, Rectangle block, CollisionDirection direction, Vector2 &depth ) : bool
player Microsoft.Xna.Framework.Rectangle A player's bounding rectangle
block Microsoft.Xna.Framework.Rectangle A block's brounding rectangle
direction CollisionDirection Collision direction
depth Vector2 Returned depth of the collision
return bool
        public static bool TileIntersectsPlayer(Rectangle player, Rectangle block, CollisionDirection direction, out Vector2 depth)
        {
            depth = direction == CollisionDirection.Vertical ? new Vector2(0, player.GetVerticalIntersectionDepth(block)) : new Vector2(player.GetHorizontalIntersectionDepth(block), 0);
            return depth.Y != 0 || depth.X != 0;
        }