public object SetObjectData(object obj, SerializationInfo info, StreamingContext context, ISurrogateSelector selector) { return(HoloNetPlayer.FindPlayer(info.GetInt32("uniqueId"))); }
protected bool Equals(HoloNetPlayer other) { return(uniqueId == other.uniqueId); }
private void UpdatePlayersCache() { _serverPlayerCache = Players.FirstOrDefault(item => item.isServer); _localPlayerCache = Players.FirstOrDefault(item => item.isLocal); }
public void OnPlayerDisconnectedFromRoom(HoloNetPlayer disconnectedPlayer) { HoloNetAppModule.instance.messenger.Publish(NetPlayerDisconnectedMessage.Create(disconnectedPlayer)); Players.Remove(disconnectedPlayer); UpdatePlayersCache(); }
public void OnPlayerConnectedToRoom(HoloNetPlayer newPlayer) { RegisterPlayer(newPlayer); HoloNetAppModule.instance.messenger.Publish(NetPlayerConnectedMessage.Create(newPlayer)); UpdatePlayersCache(); }
public void RegisterPlayer(HoloNetPlayer player) { Players.Add(player); }