public void Update() { for (int i = 0; i < listTankEnemy.Count; i++) { listTankEnemy[i].Update(); } for (int i = 0; i < listBullet.Count; i++) { listBullet[i].Update(); } if (StateOfLevel != StateOfLevel.GameOver) { tankPlayer.Update(); } else if (intervalGameOver == SizeGame.HeighWindowGame / 2) { BattleCity.StateOfGame = StateOfGame.GameOver; } else if (intervalGameOver == SizeGame.HeighWindowGame) { listEagle.Add(imgGameOver); intervalGameOver--; } else { imgGameOver.Update(); intervalGameOver--; } if (dictionaryObjGame[KeyObjGame.TankEnemy].Count < 3 && countEnemy < 20) { AddEnemy(); } }
public void Update() { if (StateOfLevel == StateOfLevel.Download) { if (!informationDownloadLevel.IsShow()) { listInformation.Remove(informationDownloadLevel); tankPlayer = new SmallTankPlayer(respawnPlayer, Direction.Up); new AppearanceOfTank(respawnPlayer, tankPlayer); enemyTanks = new EnemyTanks(TanksEnemy); enemyTanks.AddEnemy(); StateOfLevel = StateOfLevel.Game; } else { informationDownloadLevel.Update(); } } if (StateOfLevel != StateOfLevel.GameOver) { for (int i = 0; i < listPlayer.Count; i++) { listPlayer[i].Update(); } } for (int i = 0; i < listOther.Count; i++) { listOther[i].Update(); } foreach (var item in listWater) { item.Update(); } for (int i = 0; i < listTankEnemy.Count; i++) { listTankEnemy[i].Update(); } for (int i = 0; i < listShell.Count; i++) { listShell[i].Update(); } if (StateOfLevel == StateOfLevel.GameOver) { if (imgGameOver == null) { SoundGame.Stop(); imgGameOver = new ImgGameOver(); listInformation.Add(imgGameOver); } else { imgGameOver.Update(); } } if (StateOfLevel == StateOfLevel.Game) { // Если вражиских танков неосталось if (listTankEnemy.Count == 0 && !enemyTanks.IsTanks()) { if (timerWin == 0) { SoundGame.Stop(); TimerWin(); } else { timerWin--; } } else if (listTankEnemy.Count < 3) { enemyTanks.AddEnemy(); } } }