Пример #1
0
        public static void Load()
        {
            StatTracker.Reset();

            string data_string = SaveDataHandler.LoadData(Settings.StatTrackerSavePath);

            if (data_string != null)
            {
                StatTracker.FoodEaten = int.Parse(data_string);
            }
        }
Пример #2
0
        public override void onGameEvent(GameEvent game_event)
        {
            base.onGameEvent(game_event);

            if (game_event is FoodEatenEvent)
            {
                StatTracker.FoodEaten++;
            }
            else if (game_event is SnakeDiedEvent)
            {
                StatTracker.Save();
                StatTracker.PostFoodStatOnly();
            }
        }
Пример #3
0
        public override void onGameEvent(GameEvent game_event)
        {
            base.onGameEvent(game_event);

            if (game_event is SnakePartDestroyedEvent)
            {
                this.CurrentScore++;
                if (this.CurrentScore > this.HighScore)
                {
                    this.HighScore      = this.CurrentScore;
                    this.IsNewHighscore = true;
                }
            }
            else if (game_event is SnakeDestructionDoneEvent)
            {
                if (this.IsNewHighscore)
                {
                    this.SaveHighscore();
                    StatTracker.PostStats(true);
                }
            }
        }