Пример #1
0
        static public object Deserialize(byte[] data)
        {
            PCAID result = new PCAID();

            result.ID = Encoding.UTF8.GetString(data);

            return(result);
        }
        private void Unregister(IPCA pca)
        {
            if (PCAID.IsNotSet(pca.ID))
            {
                return;
            }

            Debug.Log($"Unregisterd a PCA ID [{pca.ID}]");

            _persistentRepository.Unregister(pca);
        }
        private void Register(IPCA pca)
        {
            if (PCAID.IsNotSet(pca.ID))
            {
                pca.ID = CreateNewID(pca);
            }

            Debug.Log($"Registerd a PCA ID [{pca.ID}]");

            _persistentRepository.Register(pca);
        }
Пример #4
0
        private void ReceiveData(PhotonStream stream)
        {
            _remotePCADatabase.Clear();

            int count = (int)stream.ReceiveNext();

            for (int i = 0; i < count; i++)
            {
                PCAID      id  = (PCAID)stream.ReceiveNext();
                Vector3    pos = (Vector3)stream.ReceiveNext();
                Quaternion rot = (Quaternion)stream.ReceiveNext();

                _remotePCADatabase.Add(id, new Pose
                {
                    position = pos,
                    rotation = rot,
                });
            }

            AdaptToRemotePose();
        }
Пример #5
0
        private void ReceiveData(PhotonStream stream)
        {
            _remotePCADatabase.Clear();

            int count = (int)stream.ReceiveNext();

            for (int i = 0; i < count; i++)
            {
                PCAID      id  = (PCAID)stream.ReceiveNext();
                Vector3    pos = (Vector3)stream.ReceiveNext();
                Quaternion rot = (Quaternion)stream.ReceiveNext();

                _remotePCADatabase.Add(id, new Pose
                {
                    position = pos,
                    rotation = rot,
                });
            }

            Pose adaptPose = _anchorService.GetAnchorPose(_remotePCADatabase);

            transform.SetPositionAndRotation(adaptPose.position, adaptPose.rotation);
        }
Пример #6
0
        static public byte[] Serialize(object customType)
        {
            PCAID id = (PCAID)customType;

            return(Encoding.UTF8.GetBytes(id.ID));
        }