Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Web / PUSG.Web / Models / CollisionEngine.cs
blob: 4ae2e13257195df424f49f151be9929cbbe9caaa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.Drawing;

namespace PUSG.Web.Models
{
    public class CollisionEngine
    {
        public static bool CollidesTankWithShell(BaseGameObject tank, BaseGameObject shell)
        {
            Rectangle targetRectangle = new Rectangle((int)tank.X, (int)tank.Y, 50, 40);

            Rectangle colliderRectangle = new Rectangle((int)shell.X, (int)shell.Y, 25, 25);

            return colliderRectangle.IntersectsWith(targetRectangle);
        }
    }
}