コード例 #1
0
    private void RegisterHandler(FSM_A_PlayerComponent _player, bool _add)
    {
        if (_player == null || !_player.IsValid)
        {
            return;
        }

        bool _canHandle = _add ? !ContainsPlayer(_player) : ContainsPlayer(_player);

        if (!_canHandle)
        {
            throw new Exception("Invalid Player component");
        }

        if (_add)
        {
            players.Add(_player.ID, _player);
        }
        else
        {
            players.Remove(_player.ID);
        }
    }
コード例 #2
0
 private bool ContainsPlayer(FSM_A_PlayerComponent _player) => players.ContainsKey(_player.ID);
コード例 #3
0
 public void UnRegister(FSM_A_PlayerComponent _player)
 {
     RegisterHandler(_player, false);
 }
コード例 #4
0
 public void Register(FSM_A_PlayerComponent _player)
 {
     RegisterHandler(_player, true);
 }