public static void ObstacleHelicopterColision(Obstacle obstacle, Helicopter helicopter, ref bool collision, ref int lives, ref BigInteger score, int bombs) { if ((obstacle.StartX == helicopter.EndX && !(obstacle.EndY < helicopter.StartY || obstacle.StartY > helicopter.EndY)) || ((obstacle.EndY == helicopter.StartY || obstacle.StartY == helicopter.EndY) && !(obstacle.EndX < helicopter.StartX || obstacle.StartX > helicopter.EndX)) || (obstacle.EndX == helicopter.StartX && !(obstacle.EndY < helicopter.StartY || obstacle.StartY > helicopter.EndY))) { obstacle.StartX++; Window.DeleteObstacle(obstacle); lives--; score -= 100; collision = true; if (lives == 0) { EndGameScreen.FinishGame(score); } else { Window.UpdateScoreAndLives(lives, bombs, score, false, 0); } } }
//Helicopter Collision public static void HelicopterObstacleColision(List <Obstacle> obstacles, Helicopter helicopter, ref int lives, ref BigInteger score, int bombs) { for (int i = 0; i < obstacles.Count; i++) { if ((obstacles[i].StartX == helicopter.EndX && !(obstacles[i].EndY <helicopter.StartY || obstacles[i].StartY> helicopter.EndY)) || ((obstacles[i].EndY == helicopter.StartY || obstacles[i].StartY == helicopter.EndY) && !(obstacles[i].EndX <helicopter.StartX || obstacles[i].StartX> helicopter.EndX)) || (obstacles[i].EndX == helicopter.StartX && !(obstacles[i].EndY <helicopter.StartY || obstacles[i].StartY> helicopter.EndY))) { Window.DeleteObstacle(obstacles[i]); obstacles.RemoveAt(i); i--; lives--; score -= 100; if (lives == 0) { EndGameScreen.FinishGame(score); } else { Window.UpdateScoreAndLives(lives, bombs, score, false, 0); } } } }