コード例 #1
0
    /// <summary>
    /// Create the button used to return to the main menu, and save the curriculum and
    /// load the main menu if it has been clicked.
    /// </summary>
    private void CreateMainMenuBtn()
    {
        // Create the button used to create a new lesson.  If it was clicked...
        if (GUI.Button(new Rect(Screen.width - (200 * scaleFactor), Screen.height - (90 * scaleFactor), (150 * scaleFactor), (40 * scaleFactor)), "Main Menu", mainMenuButtonStyle))
        {
            GameStateUtilities.Save(playerData);

            // Return to the main menu
            Application.LoadLevel("MainMenu");
        }
    }
コード例 #2
0
    /// <summary>
    /// Saves user's current game preferences, scores, and HP
    /// </summary>
    private void SaveGamePreferences()
    {
        PlayerData dataToSave = GameStateUtilities.Load();

        dataToSave.Curriculum        = Context.Curriculum;
        dataToSave.CurrentLessonId   = Context.CurrentLessonId;
        dataToSave.LifeCount         = (int)Context.PlayerHealth.CurHealth;
        dataToSave.CurrentScore      = Context.CurrentScore.Score;
        dataToSave.EnemyDifficultyId = Context.EnemyDifficulty.ID;
        GameStateUtilities.Save(dataToSave);
    }