void Awake() { screenWidth = Screen.width; screenHeight = Screen.height; spm = (ServerPlayerManager)gameObject.GetComponent(typeof(ServerPlayerManager)); maxClients = int.Parse(SceneProperties.playerSize); }
public void SendFrom(string clientId, Vector3 _position, Quaternion _rotation) { GameObject prefab = Instantiate(References.defaults.SERVER_PLAYER_PREFAB, _position, _rotation); ServerPlayerManager.AddPlayerPrefab(prefab, clientId); // spawn new client onn all existing clients SendPackageFrom(clientId, new SpawnFlowServerPackage() { position = _position, rotation = _rotation }).SendAll(SendMethod.ReliableOrdered); // spawn already existing clients on the newly connected client FlowServer.IterateConnectedClients((FlowClientServer client) => { if (client.id != clientId) { SendPackageFrom(client.id, new SpawnFlowServerPackage() { position = _position, rotation = _rotation }).Send(SendMethod.ReliableOrdered, clientId); } return(true); }); }
void Awake() { screenWidth = Screen.width; screenHeight = Screen.height; spm = (ServerPlayerManager) gameObject.GetComponent(typeof(ServerPlayerManager)); maxClients = int.Parse(SceneProperties.playerSize); }
public void SendFrom(string clientId) { ServerPlayerManager.RemovePlayerPrefab(clientId); SendPackageFrom(clientId, new DisconnectFlowServerPackage() { message = $"Client ({clientId}) has disconnected.", }).SendExcept(SendMethod.ReliableUnordered, new string[] { clientId }); }
public NetworkEntityProcessor() { _networkMessageWriter = new NetworkMessageWriter(new LiteNetLib.Utils.NetDataWriter()); _serverPlayerManager = new ServerPlayerManager(4, this); _clientPlayerManager = new ClientPlayerManager(this); Order = -20000; // Ensure this occurs before other processors // Not using Enabled property, because that completely disables the processor, where it doesn't even pick up newly added entities IsEnabled = true; }
void Awake() { spm = (ServerPlayerManager)gameObject.GetComponent(typeof(ServerPlayerManager)); }
void Awake() { spm = (ServerPlayerManager) gameObject.GetComponent(typeof(ServerPlayerManager)); }