public TeleportSpawnMessage(ITeleportObjectSpawner spawner, GameObject existing, object objectConfig) { _objectConfig = objectConfig; _spawner = spawner; _instanceId = _spawner.GetInstanceId(existing); SpawnedObject = existing; }
public TeleportSpawnMessage(ITeleportObjectSpawner spawner, Vector3 position, object objectConfig) { _objectConfig = objectConfig; _spawner = spawner; Position = position; _instanceId = _spawner.GetNextInstanceId(); }
public void RegisterSpawner(ITeleportObjectSpawner spawner) { var spawnerId = (ushort)_clientSpawners.Count; spawner.AssignSpawnId(spawnerId); _clientSpawners.Add(spawner.Duplicate(TeleportObjectSpawnerType.ClientSide)); _serverSpawners.Add(spawner.Duplicate(TeleportObjectSpawnerType.ServerSide)); }
public override void Deserialize(TeleportReader reader) { base.Deserialize(reader); SpawnId = reader.ReadUInt16(); _instanceId = reader.ReadUInt16(); _spawner = TeleportManager.Main.GetClientSpawner(SpawnId); // The reader will be closed by the time we use it, so we create a new reader var rawData = ((MemoryStream)reader.BaseStream).ToArray(); var data = new byte[rawData.Length - reader.BaseStream.Position]; Array.Copy(rawData, reader.BaseStream.Position, data, 0, data.Length); _reader = new TeleportReader(data); }
public void OnTimedPlayback() { _spawner = TeleportManager.Main.GetClientSpawner(SpawnId); SpawnedObject = _spawner.ClientSideSpawn(_instanceId, _reader); _reader.Close(); }
public TeleportDespawnMessage(ITeleportObjectSpawner spawner, ushort instanceId) { _spawner = spawner; _instanceId = instanceId; }
public TeleportStateSyncMessage(ITeleportObjectSpawner spawner, ITeleportState[] states) { _spawner = spawner; _spawnId = spawner.SpawnId; _states = states; }