Пример #1
0
    public void CalculateScores()
    {
        Logger.Log(Logger.Score, "Finished counting score.");

        ICharacterManager characterManager = GameManager.Instance.CharacterManager;

        if (characterManager == null)
        {
            return;
        }

        if (characterManager.GetPlayers <MazePlayerCharacter>().Count == 1)
        {
            PlayerMazeScores.Add(PlayerNumber.Player1, new PlayerMazeScore());
        }
        else
        {
            PlayerMazeScores.Add(PlayerNumber.Player1, new PlayerMazeScore());
            PlayerMazeScores.Add(PlayerNumber.Player2, new PlayerMazeScore());
        }

        CountTileMarkerScores();
        CountEnemyEncountersScores();
        CountFirstFinishedBonus();

        Dictionary <PlayerNumber, PlayerMazeScore> tempPlayerScores = new Dictionary <PlayerNumber, PlayerMazeScore>();

        foreach (KeyValuePair <PlayerNumber, PlayerMazeScore> item in PlayerMazeScores)
        {
            int             mazeTotal       = item.Value.CountMazeTotal();
            PlayerMazeScore playerMazeScore = item.Value;
            playerMazeScore.MazeScore = mazeTotal;
            tempPlayerScores.Add(item.Key, playerMazeScore);

            PersistentGameManager.UpdatePlayerOveralScoresWithMazeScore(item.Key, playerMazeScore.MazeScore);
        }

        PlayerMazeScores = tempPlayerScores;
    }