Esempio n. 1
0
        public override void Deserialize(BitStream bs, ReplicaSerializationMode mode)
        {
            var isViewClientControlled = bs.ReadBool();

            if (isViewClientControlled)
            {
                return;
            }

            var pos = bs.ReadVector3();
            var yaw = bs.ReadFloat();

            if (_pawn == null || _pawn.isMounted)
            {
                return;
            }

            _serverPosition = pos;
            _serverYaw      = yaw;
        }
Esempio n. 2
0
        public override void Deserialize(BitStream bs, ReplicaSerializationMode mode)
        {
            if (mode == ReplicaSerializationMode.Full)
            {
                _data.type = bs.ReadNetworkObject <BuildingType>();

                _data.parts.Clear();
                Clear();
                var count = bs.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    var part = new Part();
                    part.type     = bs.ReadNetworkObject <BuildingPartType>();
                    part.position = bs.ReadVector3();
                    part.rotation = bs.ReadQuaternion();

                    _data.parts.Add(part);
                }
                Rebuild();
            }
        }