public override void Deserialize(NetBuffer buffer)
        {
            base.Deserialize(buffer);

            if (this.stateFlag != null)
            {
                ByteFlag stateFlag = (ByteFlag)this.stateFlag.Value;
                IsFlashlightOn = stateFlag.Get(0);
                IsReloading    = stateFlag.Get(1);
            }

            if (this.movementFlag != null)
            {
                ByteFlag movementFlag = (ByteFlag)this.movementFlag.Value;

                IsCrouching = movementFlag.Get(0);
                IsSprinting = movementFlag.Get(1);
                IsMoving    = movementFlag.Get(2);
                IsAiming    = movementFlag.Get(3);
                IsGrounded  = movementFlag.Get(4);
                IsJumping   = movementFlag.Get(5);
            }

            if (NetId != initId)
            {
                throw new Exception(string.Format(
                                        "PlayerSnapshot id mismatch! Server had different id than client! (NetId, initId) {0} != {1}", NetId, initId));
            }
        }
Ejemplo n.º 2
0
        public override void Deserialize(NetBuffer packet)
        {
            base.Deserialize(packet);

            ByteFlag actionFlag = (ByteFlag)this.actionFlag.Value;

            IsFlashlightVisible = actionFlag.Get(0);
            Reload    = actionFlag.Get(1);
            DropIntel = actionFlag.Get(2);

            ByteFlag movementFlag = (ByteFlag)this.movementFlag.Value;

            IsCrouching = movementFlag.Get(0);
            IsSprinting = movementFlag.Get(1);
            IsMoving    = movementFlag.Get(2);
            IsAiming    = movementFlag.Get(3);
            IsGrounded  = movementFlag.Get(4);
            Jump        = movementFlag.Get(5);
        }
Ejemplo n.º 3
0
 public void FromByteFlag(ByteFlag movementFlag, bool isAiming)
 {
     Sprint       = movementFlag.Get(0);
     Crouch       = movementFlag.Get(1);
     Jump         = movementFlag.Get(2);
     MoveForward  = movementFlag.Get(3);
     MoveBackward = movementFlag.Get(4);
     MoveLeft     = movementFlag.Get(5);
     MoveRight    = movementFlag.Get(6);
     Walk         = movementFlag.Get(7);
     Aiming       = isAiming;
 }
        internal bool ReadHeader()
        {
            Position = 0;
            char prefix = ReadChar();

            if (prefix != PACKET_PREFIX)
            {
                return(false);
            }
            else
            {
                Type = (NetPacketType)ReadByte();
                Id   = ReadUInt16();

                ByteFlag flags = ReadByteFlag();
                isReliable   = flags.Get(0);
                isChunked    = flags.Get(1);
                isCompressed = flags.Get(2);
                isEncrypted  = flags.Get(3);
                isPartial    = flags.Get(4);

                return(true);
            }
        }