public static void PlayerDied() { List <Player> alivePlayers = _instance.players.Where(pl => pl.IsAlive).ToList(); if (_instance.isPlayingRound && alivePlayers.Count == 1) { Player winner = alivePlayers[0]; IntValue winnerRoundsWon = _instance.allPlayersRoundWonValues[_instance.players.IndexOf(winner)]; winnerRoundsWon.SetValue(winnerRoundsWon.Value + 1); if (winnerRoundsWon.Value == 2) { _instance.endMatchUI.gameObject.SetActive(true); SFXManager.PlaySFX(SFXManager.SFXType.Win); return; } Destroy(winner.gameObject); for (int i = 0; i < _instance.shells.Count; i++) { if (_instance.shells[i] != null) { Destroy(_instance.shells[i].gameObject); } } //for (int i = 0; i < _instance.props.Count; i++) //{ // Destroy(_instance.props[i].gameObject); //} _instance.PlacePlayers(); _instance.PlaceShells(); _instance.PlaceProps(); _instance.isPlayingRound = false; FindObjectOfType <StartRoundCountDown>().StartCountDown(); } }
public void ScoreDestroyedCells(IEnumerable <Cell> cells) { intValue.SetValue(intValue.GetValue() + cells.Count()); }