Пример #1
0
        private static void Project(Vector2 axis, Hitbox hitbox, ref float min, ref float max)
        {
            var dotProduct = Vector2.Dot(axis, hitbox[0]);

            min = dotProduct;
            max = dotProduct;

            for (var i = 1; i < hitbox.VertexCount; i++)
            {
                dotProduct = Vector2.Dot(hitbox[i], axis);

                if (dotProduct < min)
                {
                    min = dotProduct;
                }
                else if (dotProduct > max)
                {
                    max = dotProduct;
                }
            }
        }
Пример #2
0
 public CollisionResult CollidesWith(ICollidable c)
 {
     return(Hitbox.CheckCollision(this, c, new Vector2(0, 0)));
 }
Пример #3
0
 protected override void OnUnload()
 {
     Hitbox.RemoveCollidable(this);
 }