Esempio n. 1
0
        private static bool RectangleIntersectsPlayer(RectangleF playerArea, RectangleF blockArea, Alignment collisionAlignment, out Vector2 depth)
        {
            depth = collisionAlignment == Alignment.Vertical ?
                new Vector2(0, playerArea.GetVerticalIntersectionDepth(blockArea)) :
                new Vector2(playerArea.GetHorizontalIntersectionDepth(blockArea), 0);

            return depth.Y != 0 || depth.X != 0;
        }