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); } }
private bool ContainsPlayer(FSM_A_PlayerComponent _player) => players.ContainsKey(_player.ID);
public void UnRegister(FSM_A_PlayerComponent _player) { RegisterHandler(_player, false); }
public void Register(FSM_A_PlayerComponent _player) { RegisterHandler(_player, true); }