Ejemplo n.º 1
0
        private void HandleSpawnedPlayerRemoved()
        {
            int?teamIndexLeft = null;

            for (int i = 0; i < teams_.Length; i++)
            {
                HashSet <Player> team      = teams_[i];
                bool             teamAlive = team.Any(p => PlayerSpawner.IsAlive(p));
                if (teamAlive)
                {
                    // if multiple teams still alive
                    if (teamIndexLeft != null)
                    {
                        return;
                    }

                    teamIndexLeft = i;
                }
            }

            Finish();
            // possible that no teams are left alive
            if (teamIndexLeft != null)
            {
                foreach (Player player in teams_[(int)teamIndexLeft].Where(p => PlayerSpawner.IsAlive(p)))
                {
                    PlayerScores.IncrementPendingScoreFor(player);
                }
            }
        }