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)); }
public void RemoveObstacle(AObstacle obstacle) { Obstacles.Remove(obstacle); }
public void AddObstacle(AObstacle obstacle) { Obstacles.Add(obstacle); }