| | 1 | | using AvatarSystem; |
| | 2 | | using Cysharp.Threading.Tasks; |
| | 3 | | using DCL.Components; |
| | 4 | | using DCL.Configuration; |
| | 5 | | using DCL.Controllers; |
| | 6 | | using DCL.Emotes; |
| | 7 | | using DCL.Helpers; |
| | 8 | | using DCL.Interface; |
| | 9 | | using DCL.Models; |
| | 10 | | using System; |
| | 11 | | using System.Collections.Generic; |
| | 12 | | using System.Linq; |
| | 13 | | using System.Threading; |
| | 14 | | using UnityEngine; |
| | 15 | | using LOD = AvatarSystem.LOD; |
| | 16 | |
|
| | 17 | | namespace DCL.ECSComponents |
| | 18 | | { |
| | 19 | | public interface IAvatarShape |
| | 20 | | { |
| | 21 | | /// <summary> |
| | 22 | | /// This will initialize the AvatarShape and set |
| | 23 | | /// </summary> |
| | 24 | | void Init(); |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Clean up the avatar shape so we can reutilizate it using the pool |
| | 28 | | /// </summary> |
| | 29 | | void Cleanup(); |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Apply the model of the avatar, it will reload if necessary |
| | 33 | | /// </summary> |
| | 34 | | /// <param name="scene"></param> |
| | 35 | | /// <param name="entity"></param> |
| | 36 | | /// <param name="newModel"></param> |
| | 37 | | void ApplyModel(IParcelScene scene, IDCLEntity entity, PBAvatarShape newModel); |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Get the transform of the avatar shape |
| | 41 | | /// </summary> |
| | 42 | | Transform transform { get; } |
| | 43 | |
|
| | 44 | | /// <summary> |
| | 45 | | /// Get non-monobehaviour internal IAvatar object that contains the merged renderer |
| | 46 | | /// </summary> |
| | 47 | | IAvatar internalAvatar { get; } |
| | 48 | | } |
| | 49 | |
|
| | 50 | | public class AvatarShape : MonoBehaviour, IHideAvatarAreaHandler, IPoolableObjectContainer, IAvatarShape, IPoolLifec |
| | 51 | | { |
| | 52 | | private const float AVATAR_Y_AXIS_OFFSET = -0.72f; |
| | 53 | | private const float MINIMUM_PLAYERNAME_HEIGHT = 2.7f; |
| | 54 | | internal const string IN_HIDE_AREA = "IN_HIDE_AREA"; |
| | 55 | | private const string OPEN_PASSPORT_SOURCE = "World"; |
| | 56 | |
|
| | 57 | | [SerializeField] private GameObject avatarContainer; |
| | 58 | | [SerializeField] internal Collider avatarCollider; |
| | 59 | |
|
| | 60 | | [SerializeField] internal AvatarOnPointerDown onPointerDown; |
| | 61 | | [SerializeField] internal AvatarOutlineOnHoverEvent outlineOnHover; |
| | 62 | | [SerializeField] internal GameObject playerNameContainer; |
| | 63 | | [SerializeField] private Transform baseAvatarContainer; |
| | 64 | | [SerializeField] internal BaseAvatarReferences baseAvatarReferencesPrefab; |
| | 65 | |
|
| | 66 | | internal IAvatarMovementController avatarMovementController; |
| | 67 | | internal IPlayerName playerName; |
| | 68 | | internal IAvatarReporterController avatarReporterController; |
| | 69 | |
|
| | 70 | | private BaseVariable<(string playerId, string source)> currentPlayerInfoCardId; |
| | 71 | |
|
| | 72 | | internal bool initializedPosition = false; |
| | 73 | |
|
| | 74 | | internal Player player = null; |
| 0 | 75 | | internal BaseDictionary<string, Player> otherPlayers => DataStore.i.player.otherPlayers; |
| | 76 | |
|
| 3 | 77 | | private IAvatarAnchorPoints anchorPoints = new AvatarAnchorPoints(); |
| | 78 | | internal IAvatar avatar; |
| | 79 | | internal CancellationTokenSource loadingCts; |
| | 80 | | private ILazyTextureObserver currentLazyObserver; |
| | 81 | | private IUserProfileBridge userProfileBridge; |
| 3 | 82 | | private bool isGlobalSceneAvatar = true; |
| | 83 | |
|
| 4 | 84 | | public IPoolableObject poolableObject { get; set; } |
| | 85 | | internal PBAvatarShape model; |
| | 86 | | internal IDCLEntity entity; |
| | 87 | |
|
| | 88 | | private Service<IAvatarFactory> avatarFactory; |
| | 89 | | private Service<IEmotesCatalogService> emotesCatalog; |
| | 90 | | private IAvatarEmotesController emotesController; |
| | 91 | | private AvatarSceneEmoteHandler sceneEmoteHandler; |
| | 92 | | private IBaseAvatarReferences baseAvatarReferences; |
| 3 | 93 | | private readonly OnPointerEvent.Model viewProfilePointerModel = new () |
| | 94 | | { |
| | 95 | | type = OnPointerDown.NAME, |
| | 96 | | button = WebInterface.ACTION_BUTTON.POINTER.ToString(), |
| | 97 | | hoverText = "View Profile", |
| | 98 | | }; |
| 0 | 99 | | public IAvatar internalAvatar => avatar; |
| | 100 | |
|
| | 101 | | private void Awake() |
| | 102 | | { |
| 2 | 103 | | avatarMovementController = GetComponent<IAvatarMovementController>(); |
| | 104 | | // TODO: avoid instantiation, user profile bridge should be retrieved from the service locator |
| 2 | 105 | | userProfileBridge = new UserProfileWebInterfaceBridge(); |
| | 106 | |
|
| 2 | 107 | | currentPlayerInfoCardId = DataStore.i.HUDs.currentPlayerId; |
| 2 | 108 | | Visibility visibility = new Visibility(); |
| 2 | 109 | | avatarMovementController.SetAvatarTransform(transform); |
| | 110 | |
|
| | 111 | | // Right now the avatars that are not part of the global scene of avatar are not using LOD since |
| | 112 | | // AvatarsLodController are no taking them into account. It needs product definition and a refactor to inclu |
| 2 | 113 | | LOD avatarLOD = new LOD(avatarContainer, visibility, avatarMovementController); |
| 2 | 114 | | AvatarAnimatorLegacy animator = GetComponentInChildren<AvatarAnimatorLegacy>(); |
| | 115 | |
|
| | 116 | |
|
| | 117 | | //Ensure base avatar references |
| 2 | 118 | | baseAvatarReferences = baseAvatarContainer.GetComponentInChildren<IBaseAvatarReferences>() ?? Instantiate(ba |
| | 119 | |
|
| 2 | 120 | | avatar = avatarFactory.Ref.CreateAvatarWithHologram(avatarContainer, new BaseAvatar(baseAvatarReferences), a |
| | 121 | |
|
| 2 | 122 | | emotesController = avatar.GetEmotesController(); |
| | 123 | |
|
| 2 | 124 | | sceneEmoteHandler = new AvatarSceneEmoteHandler( |
| | 125 | | emotesController, |
| | 126 | | Environment.i.serviceLocator.Get<IEmotesService>()); |
| | 127 | |
|
| 2 | 128 | | avatarReporterController ??= new AvatarReporterController(Environment.i.world.state); |
| | 129 | |
|
| 2 | 130 | | onPointerDown.OnPointerDownReport += PlayerClicked; |
| 2 | 131 | | onPointerDown.OnPointerEnterReport += PlayerPointerEnter; |
| 2 | 132 | | onPointerDown.OnPointerExitReport += PlayerPointerExit; |
| 2 | 133 | | outlineOnHover.OnPointerEnterReport += PlayerPointerEnter; |
| 2 | 134 | | outlineOnHover.OnPointerExitReport += PlayerPointerExit; |
| 2 | 135 | | } |
| | 136 | |
|
| | 137 | | public void Init() |
| | 138 | | { |
| | 139 | | // The avatars have an offset in the Y axis, so we set the offset after the avatar has been restored from th |
| 0 | 140 | | transform.position = new Vector3(transform.position.x, AVATAR_Y_AXIS_OFFSET, transform.position.z); |
| 0 | 141 | | SetPlayerNameReference(); |
| 0 | 142 | | } |
| | 143 | |
|
| | 144 | | private void SetPlayerNameReference() |
| | 145 | | { |
| 0 | 146 | | if (playerName != null) |
| 0 | 147 | | return; |
| 0 | 148 | | playerName = GetComponentInChildren<IPlayerName>(); |
| 0 | 149 | | playerName?.Hide(true); |
| 0 | 150 | | } |
| | 151 | |
|
| | 152 | | private void PlayerClicked() |
| | 153 | | { |
| 0 | 154 | | if (model == null) |
| 0 | 155 | | return; |
| 0 | 156 | | currentPlayerInfoCardId.Set((model.Id, OPEN_PASSPORT_SOURCE)); |
| 0 | 157 | | } |
| | 158 | |
|
| | 159 | | public void OnDestroy() |
| | 160 | | { |
| 2 | 161 | | Cleanup(); |
| | 162 | |
|
| 2 | 163 | | if (poolableObject != null && poolableObject.isInsidePool) |
| 0 | 164 | | poolableObject.RemoveFromPool(); |
| 2 | 165 | | } |
| | 166 | |
|
| | 167 | | public async void ApplyModel(IParcelScene scene, IDCLEntity entity, PBAvatarShape newModel) |
| | 168 | | { |
| 0 | 169 | | this.entity = entity; |
| | 170 | |
|
| 0 | 171 | | isGlobalSceneAvatar = scene.sceneData.sceneNumber == EnvironmentSettings.AVATAR_GLOBAL_SCENE_NUMBER; |
| | 172 | |
|
| 0 | 173 | | DisablePassport(); |
| | 174 | |
|
| 0 | 175 | | bool needsLoading = !AvatarUtils.HaveSameWearablesAndColors(model,newModel); |
| 0 | 176 | | model = newModel; |
| | 177 | |
|
| | 178 | | #if UNITY_EDITOR |
| 0 | 179 | | gameObject.name = $"Avatar Shape {model.GetName()}"; |
| | 180 | | #endif |
| | 181 | |
|
| | 182 | | // To deal with the cases in which the entity transform was configured before the AvatarShape |
| 0 | 183 | | if (!initializedPosition) |
| | 184 | | { |
| 0 | 185 | | OnEntityTransformChanged(entity.gameObject.transform.localPosition, |
| | 186 | | entity.gameObject.transform.localRotation, true); |
| | 187 | | } |
| | 188 | |
|
| | 189 | | // NOTE: we subscribe here to transform changes since we might "lose" the message |
| | 190 | | // if we subscribe after a any yield |
| 0 | 191 | | entity.OnTransformChange -= OnEntityTransformChanged; |
| 0 | 192 | | entity.OnTransformChange += OnEntityTransformChanged; |
| | 193 | |
|
| 0 | 194 | | var wearableItems = model.GetWereables().ToList(); |
| 0 | 195 | | wearableItems.Add(model.GetBodyShape()); |
| | 196 | |
|
| | 197 | | // temporarily hardcoding the embedded emotes until the user profile provides the equipped ones |
| 0 | 198 | | var embeddedEmotesSo = await emotesCatalog.Ref.GetEmbeddedEmotes(); |
| 0 | 199 | | wearableItems.AddRange(embeddedEmotesSo.GetAllIds()); |
| 0 | 200 | | HashSet<string> emotes = new HashSet<string>(); |
| 0 | 201 | | emotes.UnionWith(embeddedEmotesSo.GetAllIds()); |
| | 202 | |
|
| 0 | 203 | | if (avatar.status != IAvatar.Status.Loaded || needsLoading) |
| | 204 | | { |
| 0 | 205 | | loadingCts?.Cancel(); |
| 0 | 206 | | loadingCts?.Dispose(); |
| 0 | 207 | | loadingCts = new CancellationTokenSource(); |
| | 208 | | try |
| | 209 | | { |
| 0 | 210 | | await LoadAvatar(wearableItems,emotes); |
| 0 | 211 | | } |
| 0 | 212 | | catch (Exception e) |
| | 213 | | { |
| | 214 | | // If the load of the avatar fails, we do it silently so the scene continue to operate. |
| | 215 | | // The LoadAvatar function will show the wearables but not the error itself, we need extra context |
| 0 | 216 | | if (e is not OperationCanceledException) |
| 0 | 217 | | Debug.LogException(e); |
| 0 | 218 | | } |
| | 219 | | } |
| | 220 | |
|
| 0 | 221 | | if (sceneEmoteHandler.IsSceneEmote(model.ExpressionTriggerId)) |
| 0 | 222 | | sceneEmoteHandler |
| | 223 | | .LoadAndPlayEmote(model.BodyShape, model.ExpressionTriggerId) |
| | 224 | | .Forget(); |
| | 225 | | else |
| 0 | 226 | | avatar.GetEmotesController().PlayEmote(model.ExpressionTriggerId, model.GetExpressionTriggerTimestamp()) |
| | 227 | |
|
| 0 | 228 | | UpdatePlayerStatus(entity, model); |
| | 229 | |
|
| 0 | 230 | | onPointerDown.Initialize( |
| | 231 | | viewProfilePointerModel, |
| | 232 | | entity, player |
| | 233 | | ); |
| | 234 | |
|
| 0 | 235 | | outlineOnHover.Initialize(entity, player.avatar); |
| | 236 | |
|
| 0 | 237 | | avatarCollider.gameObject.SetActive(true); |
| | 238 | |
|
| 0 | 239 | | EnablePassport(); |
| | 240 | |
|
| 0 | 241 | | onPointerDown.SetColliderEnabled(isGlobalSceneAvatar); |
| 0 | 242 | | onPointerDown.SetOnClickReportEnabled(isGlobalSceneAvatar); |
| 0 | 243 | | } |
| | 244 | |
|
| | 245 | | private async UniTask LoadAvatar(List<string> wearableItems, HashSet<string> emotes) |
| | 246 | | { |
| | 247 | | try |
| | 248 | | { |
| | 249 | | //TODO Add Collider to the AvatarSystem |
| | 250 | | //TODO Without this the collider could get triggered disabling the avatar container, |
| | 251 | | // this would stop the loading process due to the underlying coroutines of the AssetLoader not starting |
| 0 | 252 | | avatarCollider.gameObject.SetActive(false); |
| | 253 | |
|
| 0 | 254 | | SetImpostor(model.Id); |
| 0 | 255 | | UserProfile profile = userProfileBridge.Get(model.Id); |
| 0 | 256 | | playerName.SetName(model.GetName(), profile?.hasClaimedName ?? false, profile?.isGuest ?? false); |
| 0 | 257 | | playerName.Show(true); |
| 0 | 258 | | await avatar.Load(wearableItems, emotes.ToList(),new AvatarSettings |
| | 259 | | { |
| | 260 | | playerName = model.GetName(), |
| | 261 | | bodyshapeId = model.GetBodyShape(), |
| | 262 | | eyesColor = model.GetEyeColor().ToUnityColor(), |
| | 263 | | skinColor = model.GetSkinColor().ToUnityColor(), |
| | 264 | | hairColor = model.GetHairColor().ToUnityColor(), |
| | 265 | | }, loadingCts.Token); |
| 0 | 266 | | } |
| 0 | 267 | | catch (OperationCanceledException) |
| | 268 | | { |
| 0 | 269 | | Cleanup(); |
| 0 | 270 | | throw; |
| | 271 | | } |
| 0 | 272 | | catch (Exception e) |
| | 273 | | { |
| 0 | 274 | | Cleanup(); |
| 0 | 275 | | Debug.Log($"Avatar.Load failed with wearables:[{string.Join(",", wearableItems)}] for bodyshape:{model.B |
| 0 | 276 | | throw; |
| | 277 | | } |
| | 278 | | finally |
| | 279 | | { |
| 0 | 280 | | loadingCts?.Dispose(); |
| 0 | 281 | | loadingCts = null; |
| | 282 | | } |
| 0 | 283 | | } |
| | 284 | |
|
| | 285 | | public void SetImpostor(string userId) |
| | 286 | | { |
| 0 | 287 | | currentLazyObserver?.RemoveListener(avatar.SetImpostorTexture); |
| 0 | 288 | | if (string.IsNullOrEmpty(userId)) |
| 0 | 289 | | return; |
| | 290 | |
|
| 0 | 291 | | UserProfile userProfile = UserProfileController.GetProfileByUserId(userId); |
| 0 | 292 | | if (userProfile == null) |
| 0 | 293 | | return; |
| | 294 | |
|
| 0 | 295 | | currentLazyObserver = userProfile.bodySnapshotObserver; |
| 0 | 296 | | currentLazyObserver.AddListener(avatar.SetImpostorTexture); |
| 0 | 297 | | } |
| | 298 | |
|
| 0 | 299 | | private void PlayerPointerExit() { playerName?.SetForceShow(false); } |
| | 300 | |
|
| 0 | 301 | | private void PlayerPointerEnter() { playerName?.SetForceShow(true); } |
| | 302 | |
|
| | 303 | | internal void UpdatePlayerStatus(IDCLEntity entity, PBAvatarShape model) |
| | 304 | | { |
| | 305 | | // Remove the player status if the userId changes |
| 0 | 306 | | if (player != null && (player.id != model.Id || player.name != model.GetName())) |
| 0 | 307 | | otherPlayers.Remove(player.id); |
| | 308 | |
|
| 0 | 309 | | if (isGlobalSceneAvatar && string.IsNullOrEmpty(model?.GetName())) |
| 0 | 310 | | return; |
| | 311 | |
|
| 0 | 312 | | bool isNew = player == null; |
| 0 | 313 | | if (isNew) |
| 0 | 314 | | player = new Player(); |
| | 315 | |
|
| 0 | 316 | | bool isNameDirty = player.name != model.GetName(); |
| | 317 | |
|
| 0 | 318 | | player.id = model.Id; |
| 0 | 319 | | player.name = model.GetName(); |
| 0 | 320 | | player.isTalking = model.Talking; |
| 0 | 321 | | player.worldPosition = entity.gameObject.transform.position; |
| 0 | 322 | | player.avatar = avatar; |
| 0 | 323 | | player.onPointerDownCollider = onPointerDown; |
| 0 | 324 | | player.collider = avatarCollider; |
| | 325 | |
|
| 0 | 326 | | if (isNew) |
| | 327 | | { |
| 0 | 328 | | player.playerName = playerName; |
| 0 | 329 | | player.playerName.Show(); |
| 0 | 330 | | player.anchorPoints = anchorPoints; |
| 0 | 331 | | if (isGlobalSceneAvatar) |
| | 332 | | { |
| | 333 | | // TODO: Note: This is having a problem, sometimes the users has been detected as new 2 times and it |
| | 334 | | // we should investigate this |
| 0 | 335 | | if (otherPlayers.ContainsKey(player.id)) |
| 0 | 336 | | otherPlayers.Remove(player.id); |
| 0 | 337 | | otherPlayers.Add(player.id, player); |
| | 338 | | } |
| 0 | 339 | | avatarReporterController.ReportAvatarRemoved(); |
| | 340 | | } |
| | 341 | |
|
| 0 | 342 | | avatarReporterController.SetUp(entity.scene.sceneData.sceneNumber, player.id); |
| | 343 | |
|
| 0 | 344 | | float height = AvatarSystemUtils.AVATAR_Y_OFFSET + avatar.extents.y; |
| | 345 | |
|
| 0 | 346 | | anchorPoints.Prepare(avatarContainer.transform, baseAvatarReferences.Anchors, height); |
| | 347 | |
|
| 0 | 348 | | player.playerName.SetIsTalking(model.Talking); |
| 0 | 349 | | player.playerName.SetYOffset(Mathf.Max(MINIMUM_PLAYERNAME_HEIGHT, height)); |
| | 350 | |
|
| 0 | 351 | | if (isNameDirty) |
| | 352 | | { |
| 0 | 353 | | UserProfile profile = userProfileBridge.Get(model.Id); |
| 0 | 354 | | player.playerName.SetName(model.GetName(), profile?.hasClaimedName ?? false, profile?.isGuest ?? false); |
| | 355 | | } |
| 0 | 356 | | } |
| | 357 | |
|
| | 358 | | private void Update() |
| | 359 | | { |
| 0 | 360 | | if (player == null || entity == null) |
| 0 | 361 | | return; |
| | 362 | |
|
| 0 | 363 | | player.worldPosition = entity.gameObject.transform.position; |
| 0 | 364 | | player.forwardDirection = entity.gameObject.transform.forward; |
| 0 | 365 | | avatarReporterController.ReportAvatarPosition(player.worldPosition); |
| 0 | 366 | | } |
| | 367 | |
|
| | 368 | | public void DisablePassport() |
| | 369 | | { |
| 0 | 370 | | if (onPointerDown.collider == null) |
| 0 | 371 | | return; |
| | 372 | |
|
| 0 | 373 | | onPointerDown.SetPassportEnabled(false); |
| 0 | 374 | | } |
| | 375 | |
|
| | 376 | | public void EnablePassport() |
| | 377 | | { |
| 0 | 378 | | if (onPointerDown.collider == null) |
| 0 | 379 | | return; |
| | 380 | |
|
| 0 | 381 | | onPointerDown.SetPassportEnabled(true); |
| 0 | 382 | | } |
| | 383 | |
|
| | 384 | | private void OnEntityTransformChanged(Vector3 newPosition, Quaternion newRotation) |
| | 385 | | { |
| 0 | 386 | | OnEntityTransformChanged(newPosition, newRotation, !initializedPosition); |
| 0 | 387 | | } |
| | 388 | |
|
| | 389 | | private void OnEntityTransformChanged(Vector3 position, Quaternion rotation, bool inmediate) |
| | 390 | | { |
| 0 | 391 | | if (entity == null) |
| 0 | 392 | | return; |
| | 393 | |
|
| 0 | 394 | | if (isGlobalSceneAvatar) |
| | 395 | | { |
| 0 | 396 | | avatarMovementController.OnTransformChanged(position, rotation, inmediate); |
| | 397 | | } |
| | 398 | | else |
| | 399 | | { |
| 0 | 400 | | var scenePosition = Helpers.Utils.GridToWorldPosition(entity.scene.sceneData.basePosition.x, entity.scen |
| 0 | 401 | | avatarMovementController.OnTransformChanged(scenePosition + position, rotation, inmediate); |
| | 402 | | } |
| 0 | 403 | | initializedPosition = true; |
| 0 | 404 | | } |
| | 405 | |
|
| | 406 | | public void OnPoolRelease() |
| | 407 | | { |
| 0 | 408 | | Cleanup(); |
| 0 | 409 | | } |
| | 410 | |
|
| | 411 | | public void OnPoolGet() |
| | 412 | | { |
| 0 | 413 | | initializedPosition = false; |
| 0 | 414 | | model = new PBAvatarShape(); |
| 0 | 415 | | player = null; |
| 0 | 416 | | SetPlayerNameReference(); |
| 0 | 417 | | } |
| | 418 | |
|
| | 419 | | public void ApplyHideAvatarModifier() |
| | 420 | | { |
| 0 | 421 | | avatar.AddVisibilityConstraint(IN_HIDE_AREA); |
| 0 | 422 | | onPointerDown.gameObject.SetActive(false); |
| 0 | 423 | | playerNameContainer.SetActive(false); |
| 0 | 424 | | } |
| | 425 | |
|
| | 426 | | public void RemoveHideAvatarModifier() |
| | 427 | | { |
| 0 | 428 | | avatar.RemoveVisibilityConstrain(IN_HIDE_AREA); |
| 0 | 429 | | onPointerDown.gameObject.SetActive(true); |
| 0 | 430 | | playerNameContainer.SetActive(true); |
| 0 | 431 | | } |
| | 432 | |
|
| | 433 | | public void Cleanup() |
| | 434 | | { |
| 2 | 435 | | initializedPosition = false; |
| 2 | 436 | | playerName?.Hide(true); |
| 2 | 437 | | if (player != null) |
| | 438 | | { |
| 0 | 439 | | otherPlayers.Remove(player.id); |
| 0 | 440 | | player = null; |
| | 441 | | } |
| | 442 | |
|
| 2 | 443 | | loadingCts?.Cancel(); |
| 2 | 444 | | loadingCts?.Dispose(); |
| 2 | 445 | | loadingCts = null; |
| | 446 | |
|
| 2 | 447 | | currentLazyObserver?.RemoveListener(avatar.SetImpostorTexture); |
| 2 | 448 | | avatar.Dispose(); |
| | 449 | |
|
| 2 | 450 | | if (poolableObject != null) |
| | 451 | | { |
| 0 | 452 | | poolableObject.OnRelease -= Cleanup; |
| | 453 | | } |
| | 454 | |
|
| 2 | 455 | | onPointerDown.OnPointerDownReport -= PlayerClicked; |
| 2 | 456 | | onPointerDown.OnPointerEnterReport -= PlayerPointerEnter; |
| 2 | 457 | | onPointerDown.OnPointerExitReport -= PlayerPointerExit; |
| 2 | 458 | | outlineOnHover.OnPointerEnterReport -= PlayerPointerEnter; |
| 2 | 459 | | outlineOnHover.OnPointerExitReport -= PlayerPointerExit; |
| | 460 | |
|
| 2 | 461 | | if (entity != null) |
| | 462 | | { |
| 0 | 463 | | entity.OnTransformChange = null; |
| 0 | 464 | | entity = null; |
| | 465 | | } |
| | 466 | |
|
| 2 | 467 | | avatarReporterController.ReportAvatarRemoved(); |
| 2 | 468 | | } |
| | 469 | |
|
| | 470 | | [ContextMenu("Print current profile")] |
| 0 | 471 | | private void PrintCurrentProfile() { Debug.Log(JsonUtility.ToJson(model)); } |
| | 472 | | } |
| | 473 | | } |
| | 474 | |
|