private void DecodeDeltas(RailBitBuffer buffer) { this.deltas.Decode( buffer, () => RailState.DecodeDelta(buffer, this.SenderTick)); #endif }
private void EncodeDeltas( RailBitBuffer buffer, int reservedBytes) { this.deltas.Encode( buffer, RailConfig.PACKCAP_MESSAGE_TOTAL - reservedBytes, RailConfig.MAXSIZE_ENTITY, (delta) => RailState.EncodeDelta(buffer, delta)); #endif }
internal static RailEntity Create(int factoryType) { RailEntity entity = RailResource.Instance.CreateEntity(factoryType); entity.factoryType = factoryType; entity.StateBase = RailState.Create(factoryType); #if CLIENT entity.AuthStateBase = entity.StateBase.Clone(); entity.NextStateBase = entity.StateBase.Clone(); #endif return(entity); }
internal void StoreRecord() { RailStateRecord record = RailState.CreateRecord( this.Room.Tick, this.StateBase, this.outgoingStates.Latest); if (record != null) { this.outgoingStates.Store(record); } }
internal RailStateDelta ProduceDelta( Tick basisTick, IRailController destination) { RailStateRecord basis = null; if (basisTick.IsValid) { basis = this.outgoingStates.LatestAt(basisTick); } // Flags for special data modes bool includeControllerData = (destination == this.Controller); bool includeImmutableData = (basisTick.IsValid == false); return(RailState.CreateDelta( this.Id, this.StateBase, basis, includeControllerData, includeImmutableData, this.commandAck, this.RemovedTick)); }