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)); }
public void EndRound() { EndRoundHandler.ApplyTimeChanges(); if (CheckIfReachedPoints() && CheckIfOnlyWinner()) { EndGame(); } else { if (roundResults == null) { roundResults = new Dictionary <int, Tuple <Player, int> >(); } roundResults[actualRound] = Tuple.Create(players.First(), players.First().Stats.Score); Utility.KnuthShuffle(spawns); UIManager.Instance.EndRound(ResetRound); //do show winner and ui stuff //Invoke("ResetRound", 1); } }
private void Awake() { instance = this; }