/// <summary> /// Обновление состояния /// </summary> private void Update() { ProcessingKeystrokes(); switch (StateOfGame) { case StateOfGame.Menu: menu.Update(); break; case StateOfGame.Game: level.Update(); break; case StateOfGame.GameOver: gameOver.Update(); break; } }
// This is updating the game public void Update(float deltaTime) { this.deltaTime = deltaTime; if (level.IsActive()) { level.Update(deltaTime); } else { // Loading the new level when the last one finished switch (level.LoadLevel()) { case "01": level01 = new Level01(); level = level01; level.Active(); level.Init(); break; case "win": winLevel = new WinLevel(); level = winLevel; level.Active(); level.Init(); break; case "lose": loseLevel = new LoseLevel(); level = loseLevel; level.Active(); level.Init(); break; case "start": startLevel = new StartLevel(); level = startLevel; level.Active(); level.Init(); break; case "02": level02 = new Level02(); level = level02; level.Active(); level.Init(); break; case "load": loadLevel = new LoadImagesLevel(); level = loadLevel; level.Active(); level.Init(); break; } } timer += deltaTime; if (timer >= 1) { fps = frames; frames = 0; timer -= 1; } frames++; }