コード例 #1
0
        private void DecodeDeltas(RailBitBuffer buffer)
        {
            this.deltas.Decode(
                buffer,
                () => RailState.DecodeDelta(buffer, this.SenderTick));
#endif
        }
コード例 #2
0
        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
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        internal void StoreRecord()
        {
            RailStateRecord record =
                RailState.CreateRecord(
                    this.Room.Tick,
                    this.StateBase,
                    this.outgoingStates.Latest);

            if (record != null)
            {
                this.outgoingStates.Store(record);
            }
        }
コード例 #5
0
        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));
        }