Beispiel #1
0
        private async UniTask SendTransformAsync()
        {
            var packet = new TransformSyncPacket();

            if (isSyncPostion)
            {
                packet.isSyncPostion = isSyncPostion;
                packet.Postion       = transform.position;
                CachePostion         = transform.position;
            }

            if (isSyncRotation)
            {
                packet.isSyncRotation = isSyncRotation;
                packet.Rotation       = transform.rotation;
                CacheRotation         = transform.rotation;
            }

            if (isSyncScale)
            {
                packet.isSyncScale = isSyncScale;
                packet.Scale       = transform.localScale;
                CacheScale         = transform.localScale;
            }

            if (isSyncPostion || isSyncRotation || isSyncScale && SyncGameObject.IsMine)
            {
                await SyncGameObject.SendAsync(packet, typeof(SyncTransform));
            }
        }
Beispiel #2
0
        private async UniTask SendRigidbodyAsync()
        {
            var packet = new RigidbodySyncPacket();

            packet.Postion  = Rigidbody.position;
            packet.Rotation = Rigidbody.rotation;
            packet.Velocity = Rigidbody.velocity;

            await SyncGameObject.SendAsync(packet, typeof(SyncRigidbody));
        }