/// <summary> /// Let a <see cref="Player"/> try to join the Hub. /// </summary> /// <param name="_player"></param> /// <returns></returns> public bool Join(Player _player) { if (Players.Count < PlayerAmount + 1) { Players.Add(_player); return true; } return false; }
/// <summary> /// A Network message struct, for fast collection of the data. /// </summary> /// <param name="_lMessage">the data to be sent to the server</param> /// <param name="_iSequence">if the message is part of a sequence this should not be 0</param> public NetworkMessage(string _sMessage, Player _cPlayer, int _iSequence = 0) { Body = _sMessage; if (_iSequence != 0) Sequence = _iSequence; SendTime = new DateTime().Millisecond; GUID = Guid.NewGuid(); Sender = _cPlayer; }
public void PlayerJoined(Player _player) { foreach(Player _p in Players) { if(_player.GUID != _p.GUID) { } } }
/// <summary> /// Let a <see cref="Player"/> leave the Hub. /// </summary> /// <param name="_player"></param> public void Leave(Player _player) { for (int i = 0; i < Players.Count; i++) { if (Players[i].GUID == _player.GUID) { Players.RemoveAt(i); } } }