コード例 #1
0
        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);
            });
        }