private void RemoveAnyRemoteControl(GameObject gameObject) { // Some items might be remotely simulated if they were dropped by other players. We'll want to remove // any remote tracking when we actively handle the item. RemotelyControlled remotelyControlled = gameObject.GetComponent <RemotelyControlled>(); Object.Destroy(remotelyControlled); }
private void RemoveRemoteController(NitroxId id) { Optional <GameObject> gameObject = NitroxEntity.GetObjectFrom(id); if (gameObject.HasValue) { RemotelyControlled remotelyControlled = gameObject.Value.GetComponent <RemotelyControlled>(); Object.Destroy(remotelyControlled); } }
public override void Process(EntityTransformUpdates packet) { foreach (EntityTransformUpdate entity in packet.Updates) { Optional <GameObject> opGameObject = NitroxEntity.GetObjectFrom(entity.Id); if (!opGameObject.HasValue) { continue; } RemotelyControlled remotelyControlled = opGameObject.Value.GetComponent <RemotelyControlled>(); if (!remotelyControlled) { remotelyControlled = opGameObject.Value.AddComponent <RemotelyControlled>(); } remotelyControlled.UpdateOrientation(entity.Position.ToUnity(), entity.Rotation.ToUnity()); } }