public Collision(Car car, Coins coins, MainWindow mainWindow, Canvas canvas, Police police) { Car = car; Coins = coins; MainWindow = mainWindow; Canvas = canvas; Police = police; }
public MovmentManager(Car car, LineSegment lineSegment, Coins coins, Canvas canvas, Collision coliitionCoin, Police police, GameManager gameManager) { Car = car; LineSegment = lineSegment; Coins = coins; Canvas = canvas; ColiitionCoin = coliitionCoin; Police = police; GameManager = gameManager; PreperTimers(); }
private void InitializeClasses() { if (Counter == 0) { Car = new Car(Canvas); LineSegment = new LineSegment(Canvas); Coins = new Coins(Canvas); Police = new Police(Canvas); ColiitionCoin = new Collision(Car, Coins, MainWindow, Canvas, Police); MovmentManager = new MovmentManager(Car, LineSegment, Coins, Canvas, ColiitionCoin, Police, this); Counter++; } }
public void RestartGame() { Police.RmoveItemAndPointsFromCanavas(); Coins.RmoveItemAndPointsFromCanavas(); LineSegment.RmoveTheCoinsFromCanavas(); Car.CarImage.Source = null; MessageBox.Show("Great! Lets start", "Race Car"); MainWindow.GameRules.Visibility = Visibility.Visible; MainWindow.StartGame.Visibility = Visibility.Visible; MainWindow.CarOption.Visibility = Visibility.Visible; MainWindow.ImagesOfCars.Visibility = Visibility.Visible; }
public void DrawPolice(Canvas canvas) { for (int i = 0; i < Police.UIElements.Count; i++) { if (IsGameOver == false) { if (IsCanvasContainsThatPolice(canvas, i)) { IsGameOver = ColiitionCoin.CollisionPoliceWithCar(i); if (IsGameOver == true) { GameManager.EndGame(); break; } Police.CheckBoundary(canvas, i); } else { Police.AddItemEveryTwoSec(canvas, i); } } } }