Esempio n. 1
0
    // ---------- PUBLIC METHODS ----------------------------------------------------+

    #region START OR CONTINUE GAME
    // Continue the game if it was paused, start new game otherwise
    public void StartOrContinueGame()
    {
        // If game was over
        if (gameState == GameStates.GAME_OVER)
        {
            // Clear active obstacles from previous match
            obstacleManager.ClearObstacles();

            // Set serenity state
            mapManager.SetSerenityState();
        }

        // If new match
        if (gameState == GameStates.TITLE_SCREEN ||
            gameState == GameStates.GAME_OVER)
        {
            // Reset match UI
            CurrentScore_HasChanged?.Invoke(0);
            CurrentWave_HasChanged?.Invoke(1);

            // Spawn new hero
            heroManager.SpawnNewHero();

            // Reset obstacles
            obstacleManager.ResetValuesForNewGame();

            // Reset bosses
            bossManager.ResetValuesForNewGame();

            // Start moving map.
            mapManager.StartHeroEnteringState();

            // Reset dodged obstacles
            currentScore = 0;
        }

        // Fire event: Game started or continued
        GameStartedOrContinued?.Invoke(gameState != GameStates.PAUSED);

        // Set game as running or intro
        //gameState = GameStates.INTRO;
        gameState = GameStates.RUNNING;

        // Unpause game
        Time.timeScale = 1.0f; // 1
    }
Esempio n. 2
0
 public void ResetObstacles()
 {
     obstacleManager.ClearObstacles();
     obstacleManager.SetObstacles();
 }