private IEnumerator loadPropAssetAndPlayRetrieveAnim() { while (!avatarView.IsReady) { meshCombineWaitTimeSec += Time.deltaTime; if (meshCombineWaitTimeSec > 15f) { throw new Exception("RetrievePropCMD timed out while waiting for avatar mesh to combine. Was the Avatar GameObject Destroyed?"); } yield return(null); } AssetRequest <GameObject> assetRequest = null; try { assetRequest = Content.LoadAsync(propContentKey); } catch (Exception ex) { Log.LogErrorFormatted(this, "Unable to load Prop id {0}. Path was {1}. Message: {2}", propId, propContentKey, ex.Message); } if (assetRequest != null) { yield return(assetRequest); try { if (isOwnerLocalPlayer) { Service.Get <iOSHapticFeedback>().TriggerImpactFeedback(iOSHapticFeedback.ImpactFeedbackStyle.Light); } Prop propPrefab = assetRequest.Asset.GetComponent <Prop>(); Prop propInstance = UnityEngine.Object.Instantiate(propPrefab); propInstance.gameObject.SetActive(value: false); propInstance.OwnerId = ownerId; propInstance.PropId = propId; propInstance.IsOwnerLocalPlayer = isOwnerLocalPlayer; propInstance.PropDef = Service.Get <PropService>().GetPropDefinition(propId); Service.Get <TagsManager>().MakeTagsData(propInstance.gameObject, new TagDefinition[1][] { propInstance.PropDef.Tags }); if (onPropInstantiatedHandler != null) { onPropInstantiatedHandler(propInstance); } yield return(CoroutineRunner.Start(propUser.RetrieveProp(propInstance), propUser, "propUser.RetrieveProp")); } finally { if (onCompleteHandler != null) { onCompleteHandler(); } } } }
private IEnumerator retrieveProp() { if (Prop.UseOnceImmediately) { onUseDestination = onUseDestination.normalized * Prop.MaxDistanceFromUser; yield return(CoroutineRunner.Start(PropUser.RetrievePropWithImmediateUseDest(Prop, onUseDestination), this, "PropUser.RetrievePropWithImmediateUseDest")); } else { yield return(CoroutineRunner.Start(PropUser.RetrieveProp(Prop), this, "PropUser.RetrieveProp")); } Prop.gameObject.SetActive(value: true); }