public void SpawnRequest(int prefabId, NetworkClient client, Vector3 position, Quaternion rotation)
        {
            var spawnData = new SpawnRPCData
            {
                PrefabId  = prefabId,
                Ownership = EOwnershipType.Owner,
                Position  = position,
                Rotation  = rotation,
            };

            var request = RPCFactory.Create <SpawnRequestRPC, SpawnRPCData>(spawnData);

            client.Write(request);
        }
        private void OnClientConnected(NetworkConnection connection)
        {
            foreach (var instance in Instances)
            {
                var data = new SpawnRPCData
                {
                    PrefabId   = instance.PrefabId,
                    InstanceId = instance.InstanceId,
                    Ownership  = EOwnershipType.Server,
                };

                var spawnRPC = RPCFactory.Create <SpawnRPC, SpawnRPCData>(data);
                Server.Write(spawnRPC, connection);
            }

            SpawnInServer(0, new Vector3(0, 5, 0), Quaternion.identity, connection);
        }
        public void BroadcastSpawnRequest(int?connection, Ghost instance, int prefabId, int instanceId)
        {
            var ownership = EOwnershipType.Server;

            foreach (var c in Server.Connections)
            {
                if (connection != null)
                {
                    ownership = c.InternalId == connection.Value ? EOwnershipType.Owner : EOwnershipType.Server;
                }

                var spawnRPCData = new SpawnRPCData
                {
                    InstanceId = instanceId,
                    PrefabId   = prefabId,
                    Ownership  = ownership,
                    Position   = instance.transform.position,
                    Rotation   = instance.transform.rotation,
                };

                var spawnRPC = RPCFactory.Create <SpawnRPC, SpawnRPCData>(spawnRPCData);
                Server.Write(spawnRPC, c);
            }
        }