/// <summary> /// Remove an entity from being controlled by this peer. /// </summary> public void RevokeControl(ServerEntity entity) { Debug.Assert(entity.Controller == this); ControlledEntities.Remove(entity); entity.Controller = null; entity.IncomingCommands.Clear(); entity.DeferNotifyControllerChanged = true; }
/// <summary> /// Adds an entity to be controlled by this peer. /// </summary> public void GrantControl(ServerEntity entity) { if (entity.Controller != this) { Debug.Assert(entity.Controller == null); ControlledEntities.Add(entity); entity.Controller = this; entity.IncomingCommands.Clear(); entity.DeferNotifyControllerChanged = true; } }
public static StateDelta ProduceDelta(Func <StateDelta> deltaFactory, Func <int, State> stateFactory, ServerEntity entity, Tick basisTick, Controller destination) { StateRecord basis = null; if (basisTick.IsValid) { basis = entity.OutgoingStates.LatestAt(basisTick); } // Flags for special data modes var includeControllerData = destination == entity.Controller; var includeImmutableData = !basisTick.IsValid; return(CreateDelta(deltaFactory, stateFactory, entity.Id, entity.StateBase, basis, includeControllerData, includeImmutableData, entity.CommandAck, entity.RemovedTick)); }