Example #1
0
    public void EndGame()
    {
        EndRoundHandler.ResetTime();
        _gameEnded             = true;
        playerInfo.playerStats = new PlayerStats[players.Count];
        for (int i = 0; i < Players.Count; i++)
        {
            Players[i].StopVibrating();
            playerInfo.playerStats[i] = Players[i].Stats;
            Players[i].lockedByGame   = true;
        }
        Serializacion.SaveJsonToDisk(playerInfo, "Registered Players");

        var winner = Players.OrderByDescending(x => x.Stats.Score).First();

        var winnerSkills = winner.GetComponentsInChildren <ComplementarySkillBase>(true).OrderBy(x => x.SkillIndex).ToArray();

        _winPopup.Initialize(winner, winner.GetComponentInChildren <DefensiveSkillBase>(true), winner.GetComponentInChildren <Weapon>(true), winnerSkills[0], winnerSkills[1]);

        _winPopup.gameObject.SetActive(true);

        StartCoroutine(EndGameCoroutine(10f));
    }