Пример #1
0
        private void OnAvatarReceived(IConnectedPlayer player, CustomAvatarData avatar)
        {
            if (player.userId != _connectedPlayer.userId)
            {
                return;
            }

            if (avatar == null)
            {
                return;
            }

            if (avatar.hash == new CustomAvatarData().hash)
            {
                return;
            }

            avatarData = avatar;
            _avatarProvider.FetchAvatarByHash(avatar.hash, CancellationToken.None).ContinueWith(a =>
            {
                if (!a.IsFaulted && a.Result is AvatarPrefab)
                {
                    HMMainThreadDispatcher.instance.Enqueue(() =>
                    {
                        CreateAvatar(a.Result);
                    });
                }
            });
        }
        public void TryGetPoseController()
        {
            var poseControllers = gameObject.GetComponentsInChildren <AvatarPoseController>();

            if (poseControllers.Length != 0)
            {
                poseController = poseControllers.First();
                CustomAvatarData avatar = _customAvatarManager.GetAvatarByUserId(_connectedPlayer.userId);
                if (avatar != null)
                {
                    OnAvatarReceived(_connectedPlayer, avatar);
                }
            }
        }