Beispiel #1
0
        public bool IsCollision(AObstacle obstacle)
        {
            uint oX = obstacle.GetCoordinates().Key;
            uint oY = obstacle.GetCoordinates().Value;
            uint oW = obstacle.Width - 1;
            uint oH = obstacle.Height - 1;

            uint cX = Car.GetCoordinates().Key;
            uint cY = Car.GetCoordinates().Value;
            uint cW = Car.Width - 1;
            uint cH = Car.Height - 1;

            return((oX >= cX && oX <= cX + cW && oY >= cY && oY <= cY + cH) || (cX >= oX && cX <= oX + oW && cY >= oY && cY <= oY + oH));
        }
Beispiel #2
0
 public void RemoveObstacle(AObstacle obstacle)
 {
     Obstacles.Remove(obstacle);
 }
Beispiel #3
0
 public void AddObstacle(AObstacle obstacle)
 {
     Obstacles.Add(obstacle);
 }