示例#1
0
        private PlayerGameState GetPlayerState(Player player)
        {
            PlayerGameState state = null;

            _PlayerStates.TryGetValue(player.SteamId, out state);
            return(state);
        }
示例#2
0
        private bool ReadTeamSwitch(string line)
        {
            var teamSwitch = _LogParser.ReadTeamSwitch(line);

            if (teamSwitch == null)
            {
                return(false);
            }
            string steamId = teamSwitch.Player.SteamId;
            var    team    = teamSwitch.CurrentTeam;

            if (steamId == LogParser.BotId)
            {
                return(false);
            }
            var             player = GetPlayer(steamId);
            PlayerGameState state;

            if (!_PlayerStates.TryGetValue(steamId, out state))
            {
                state = new PlayerGameState(player, team);
                _PlayerStates[steamId] = state;
            }
            if
            (
                !state.RoundPlayerLeft.HasValue ||
                team == Team.CounterTerrorist ||
                team == Team.Terrorist
            )
            {
                state.Team            = team;
                state.RoundPlayerLeft = null;
                state.Kills           = 0;
                state.Deaths          = 0;
            }
            return(true);
        }