示例#1
0
        /// <summary>
        ///     Restart the given game whenever a level is completed.
        ///     Update the last compleyed level in player preferences using the level util class.
        /// </summary>
        /// <param name="gameName">Name of the game to be restarted.</param>
        public void RestartGame(string gameName)
        {
            var lastPlayedLevel    = GameLevel;
            var lastCompletedLevel = LevelUtil.GetLastCompletedLevelFromPlayerPreferences(gameName);

            if (lastPlayedLevel > lastCompletedLevel)
            {
                LevelUtil.UpdateLastCompletedLevelInPlayerPreferences(gameName);
            }

            GameLevel = lastPlayedLevel;
        }
示例#2
0
 /// <summary>
 ///    Set last completed level to the value returned by player preferences for the given game.
 /// </summary>
 public void SetLastCompletedLevel()
 {
     _lastCompletedLevel = LevelUtil.GetLastCompletedLevelFromPlayerPreferences(_gameName);
 }