| | 1 | | using Cysharp.Threading.Tasks; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Threading; |
| | 4 | | using GPUSkinning; |
| | 5 | | using UnityEngine; |
| | 6 | |
|
| | 7 | | namespace AvatarSystem |
| | 8 | | { |
| | 9 | | // [ADR 65 - https://github.com/decentraland/adr] |
| | 10 | | public class AvatarWithHologram : Avatar |
| | 11 | | { |
| | 12 | | private const float AVATAR_REVEAL_COMPLETION_OFFSET = 10; |
| | 13 | |
|
| | 14 | | private readonly IBaseAvatar baseAvatar; |
| | 15 | |
|
| | 16 | | internal AvatarWithHologram(IBaseAvatar baseAvatar, IAvatarCurator avatarCurator, ILoader loader, IVisibility vi |
| | 17 | | ILOD lod, IGPUSkinning gpuSkinning, IGPUSkinningThrottlerService gpuSkinningThrottlerService, IAvatarEmotesC |
| 0 | 18 | | : base(avatarCurator, loader, visibility, lod, gpuSkinning, gpuSkinningThrottlerService, emotesController) |
| | 19 | | { |
| 0 | 20 | | this.baseAvatar = baseAvatar; |
| 0 | 21 | | } |
| | 22 | |
|
| | 23 | | protected override async UniTask LoadTry(List<string> wearablesIds, List<string> emotesIds, AvatarSettings setti |
| | 24 | | { |
| 0 | 25 | | baseAvatar.FadeGhost(linkedCt).Forget(); //Avoid making the ghost fading a blocking part of the avatar |
| 0 | 26 | | emotesController.Prepare(settings.bodyshapeId, baseAvatar.ArmatureContainer); |
| 0 | 27 | | List<WearableItem> emotes = await LoadWearables(wearablesIds, emotesIds, settings, baseAvatar.SkinnedMeshRen |
| 0 | 28 | | Prepare(settings, emotes); |
| 0 | 29 | | Bind(); |
| | 30 | |
|
| 0 | 31 | | MeshRenderer newCombinedRenderer = loader.combinedRenderer.GetComponent<MeshRenderer>(); |
| 0 | 32 | | Inform(newCombinedRenderer); |
| 0 | 33 | | if (visibility.IsMainRenderVisible()) |
| 0 | 34 | | await baseAvatar.Reveal(GetMainRenderer(), extents.y, extents.y + AVATAR_REVEAL_COMPLETION_OFFSET, linke |
| | 35 | | else |
| 0 | 36 | | baseAvatar.RevealInstantly(GetMainRenderer(), extents.y + AVATAR_REVEAL_COMPLETION_OFFSET); |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | public override void AddVisibilityConstraint(string key) |
| | 40 | | { |
| 0 | 41 | | base.AddVisibilityConstraint(key); |
| 0 | 42 | | baseAvatar.RevealInstantly(GetMainRenderer(), extents.y + AVATAR_REVEAL_COMPLETION_OFFSET); |
| 0 | 43 | | } |
| | 44 | | } |
| | 45 | | } |