Exemplo n.º 1
0
    public void EvaluateRemainingPlayers()
    {
        List <Player> playersWithTerritory = new List <Player>();

        foreach (Vector2Int position in gameMap.Keys)
        {
            GameTile gameTile = gameMap[position];

            if (gameTile == null)
            {
                continue;
            }

            if (gameTile.owner != null && !playersWithTerritory.Contains(gameTile.owner))
            {
                playersWithTerritory.Add(gameTile.owner);
            }
        }
        for (int i = remainingPlayers.Count - 1; i >= 0; i--)
        {
            Player player = remainingPlayers[i];
            if (!playersWithTerritory.Contains(player))
            {
                remainingPlayers.Remove(player);
            }
        }
        if (remainingPlayers.Count <= 1)
        {
            VictoryScreenManager.LaunchVictoryScreen(remainingPlayers[0]);
            gameEnded = true;
        }
    }
 private void OnDestroy()
 {
     instance = null;
 }
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
     victoryCanvas.SetActive(false);
 }