コード例 #1
0
ファイル: Game.Events.cs プロジェクト: rtm516/Prophunt
        public override void ClientJoined(Client client)
        {
            base.ClientJoined(client);

            var player = new ProphuntPlayer();

            player.Respawn();

            client.Pawn = player;

            Round?.ClientJoined(client);
        }
コード例 #2
0
        private void CheckPlayers(Client ignored = null)
        {
            if (Host.IsClient)
            {
                return;
            }

            Dictionary <Team, int> playerTeams = new();
            int aliveCount = 0;

            foreach (Client client in Client.All)
            {
                if (client == ignored)
                {
                    continue;
                }
                ProphuntPlayer prophuntPlayer = client.Pawn as ProphuntPlayer;
                if (prophuntPlayer.Team != Team.Spectator)
                {
                    aliveCount++;
                    playerTeams[prophuntPlayer.Team] = playerTeams.GetValueOrDefault(prophuntPlayer.Team, 0) + 1;
                }
            }

            if (aliveCount == 0)
            {
                // If everyone is dead make props win
                Game.Instance.ChangeRound(new PostGameRound(false));
                return;
            }

            if (!playerTeams.TryGetValue(Team.Prop, out _))
            {
                // Seekers win
                Game.Instance.ChangeRound(new PostGameRound(true));
            }
            else if (!playerTeams.TryGetValue(Team.Seeker, out _))
            {
                // Props win
                Game.Instance.ChangeRound(new PostGameRound(false));
            }
        }