コード例 #1
0
        public static void failLevel()
        {
            LevelStats levelStats = stats.getLevelStates(levelName);

            levelStats.timesFailed++;

            resetLevel();
        }
コード例 #2
0
        public LevelStats getLevelStates(string levelName)
        {
            if (!allLevelStats.ContainsKey(levelName))
            {
                allLevelStats[levelName] = new LevelStats();
            }

            return(allLevelStats[levelName]);
        }
コード例 #3
0
        public static void finishLevel()
        {
            LevelStats levelStats = stats.getLevelStates(levelName);

            levelStats.timesCompleted++;
            levelStats.bestTime = Math.Min(attemptTime, levelStats.bestTime);

            // TODO: UI
            nextLevel();
        }
コード例 #4
0
        public override void render(SpriteBatch spriteBatch)
        {
            base.render(spriteBatch);

            LevelStats levelStats = Runner.stats.getLevelStates(Runner.levelName);

            Vector2 tl = pos - dimen / 2;

            spriteBatch.DrawString(font, "High Score: " + levelStats.bestTimeStr(), tl + new Vector2(20, 20), textColor);
            spriteBatch.DrawString(font, "Times Completed: " + levelStats.timesCompleted, tl + new Vector2(20, 70), textColor);
            spriteBatch.DrawString(font, "Times Failed: " + levelStats.timesFailed, tl + new Vector2(20, 120), textColor);
        }