private void World_OnAdd(StatefulObject obj) { if (obj.ID == currentOwnedObject && !obj.GetComponent <IInputController>().Enabled) { obj.GetComponent <IInputController>().SetEnabled(true); } }
public void Add(StatefulObject o, int id) { o.ID = id; statefulObjects[id] = o; OnAdd?.Invoke(o); }
public void Add(StatefulObject o) { int id = statefulObjects.Count + 1; o.ID = id; statefulObjects[id] = o; OnAdd?.Invoke(o); }
public void Add(StatefulObject o, int id, bool silent = false) { o.ID = id; statefulObjects[id] = o; o.Ownable.OnAuthorityChanged += Ownable_OnAuthorityChanged; if (!silent) { OnAdd?.Invoke(o); } }
private void StatefulWorld_OnAdd(StatefulObject obj) { if (arbiter) { IdentifiableObject o = obj.GetComponent <IdentifiableObject>(); // Only the arbiter is permitted to relinquish an object's authority; // non-arbiter remotes will hang on to authority until they receive confirmation // from the arbiter that the object has relinquished. o.GetComponent <StatefulObject>().Ownable.CanRelinquishAuthority = true; objectsToSpawn.Add(obj.ID, o); } }
public void AssignOwnership(StatefulObject statefulObject, int peerId) { if (role == Role.Server) { NetDataWriter writer = new NetDataWriter(); writer.Put((byte)PacketType.Ownership); writer.Put(statefulObject.ID); NetPeer peer = netManager.ConnectedPeerList.Where(x => x.Id == peerId - 1).First(); peer.Send(writer, DeliveryMethod.ReliableUnordered); } else { NetDebug.LogError("Attempting to assign ownership with a non-server peer."); } }
public void Add(StatefulObject o, bool silent = false) { int id = statefulObjects.Count + 1; Add(o, id); }
public void Add(StatefulObject o) { int id = statefulObjects.Count + 1; Add(o, id); }