public override void Serialize(BitStream bs, ReplicaSerializationMode mode, ReplicaView view) { var isViewClientControlled = _pawn.isMounted || (_pawn.remotePlayerController != null && _pawn.remotePlayerController.connection == view.connection); bs.Write(isViewClientControlled); if (isViewClientControlled) { return; } bs.Write(transform.position); bs.Write(transform.rotation.eulerAngles.y); }
// void Update() // { // if (_data.parts == null) // return; // // var buildingManager = SystemProvider.GetSystem<IBuildingSystem>(gameObject); // // for (int partIdx = 0; partIdx < _data.parts.Count; ++partIdx) { // var part = _data.parts[partIdx]; // var childrenIdx = _childrenIdxForPart[partIdx]; // // for (int i = 0; i < buildingManager.GetNumChildrenForPartType(_data.type, part.type); ++i) { // var childPartIdx = _partChildren[childrenIdx + i]; // if (childPartIdx == ushort.MaxValue) // continue; // // var childPart = _data.parts[childPartIdx]; // DebugDraw.DrawLine(part.position, Vector3.Lerp(part.position, childPart.position, 0.5f), Color.blue); // } // } // } #if SERVER public override void Serialize(BitStream bs, ReplicaSerializationMode mode, ReplicaView view) { if (mode == ReplicaSerializationMode.Full) { bs.Write(data.type); bs.Write(data.parts.Count); foreach (var part in data.parts) { bs.Write(part.type); bs.Write(part.position); bs.Write(part.rotation); } } }