Ejemplo n.º 1
0
    /// <summary>
    /// Starts or continues/resets the game when the button is clicked using the current exercise type.
    /// </summary>
    public void OnStartContinueClicked()
    {
        if (canStartLift && !gameData.CanContinue())
        {
            // Must check if out of bounds and cannot continue attempts
            sceneTransitionController.FadeToLevel("Game Over");
        }
        else if (canStartLift && gameData.CanContinue())
        {
            // If the lift can be started
            startButtonController.DeactivateButton();
            // Abstracted to start every exercise regardless of the type
            Invoke("StartExercise", 0.5f);
        }

        // Must check edge cases to switch scenes
        else if (isOver && gameData.CurrentExerciseType == ExerciseType.Squat)
        {
            sceneTransitionController.FadeToLevel("Squat");
        }
        else if (isOver && gameData.CurrentExerciseType == ExerciseType.Bench)
        {
            sceneTransitionController.FadeToLevel("Bench");
        }
        else if (isOver && gameData.CurrentExerciseType == ExerciseType.Deadlift)
        {
            sceneTransitionController.FadeToLevel("Deadlift");
        }
        else if (isOver && gameData.CurrentAttempt >= gameData.GetMaxAllowedAttempts())
        {
            sceneTransitionController.FadeToLevel("Main Menu");
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Toggle a pause or unpause for the current scene (SBD).
    /// </summary>
    public void Pause()
    {
        Scene scene = SceneManager.GetActiveScene();

        gameData.CurrentScene = scene.name;
        sceneTransitionController.FadeToLevel("Pause Menu");
    }
 /// <summary>
 /// Return back to the previous scene (Main Menu or Pause Menu).
 /// </summary>
 public void OnMenuClicked()
 {
     SaveSystem.SaveGame();
     sceneTransitionController.FadeToLevel("Main Menu");
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Starts the squat scene when PLAY is clicked.
 /// </summary>
 public void OnPlayClicked()
 {
     gameData.ResetLiftTracker();
     SaveSystem.SaveGame();
     sceneTransitionController.FadeToLevel("Squat");
 }