private void Update() { if (Mode != 0 || transformRef == null || isTravelComplete) { return; } elapsedTime += Time.deltaTime; if (elapsedTime >= travelTime) { isTravelComplete = true; elapsedTime = travelTime; } float num = 1f - Mathf.Abs((elapsedTime - halfTravelTime) * halfTravelTimeRecip); float num2 = ArcDelta * num; float num3 = elapsedTime * travelTimeRecip; Vector3 position = startPosition + startToDestination * num3; position.y += num2; transformRef.position = position; if (isTravelComplete) { if (RevealSpawned && SpawnedPropExperience != null) { SpawnedPropExperience.gameObject.SetActive(value: true); SpawnedPropExperience.StartExperience(); } transformRef = null; CoroutineRunner.Start(destroyAfterDelay(), this, "destroyAfterDelay"); } }
private void onPropUsed() { SpawnedInstance = (IsInstance ? PrefabToSpawn : Object.Instantiate(PrefabToSpawn)); if (ParentToUser) { SpawnedInstance.transform.SetParent(prop.PropUserRef.transform, worldPositionStays: false); } else { SpawnedInstance.transform.position = prop.OnUseDestination; CameraCullingMaskHelper.SetLayerRecursive(SpawnedInstance.transform, "AllPlayerInteractibles"); } SpawnedInstance.InstanceId = prop.ExperienceInstanceId; SpawnedInstance.OwnerId = prop.OwnerId; SpawnedInstance.IsOwnerLocalPlayer = prop.IsOwnerLocalPlayer; SpawnedInstance.PropDef = prop.PropDef; if (HideInitially) { SpawnedInstance.gameObject.SetActive(value: false); } else { SpawnedInstance.StartExperience(); } if (ApplyUserForwardVect) { SpawnedInstance.transform.forward = prop.PropUserRef.transform.forward; } }
private IEnumerator loadWorldExperience(ConsumableItem worldItem, Vector3 position) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(getPropExperiencePathFromPropId(worldItem.Type)); yield return(assetRequest); GameObject experience = UnityEngine.Object.Instantiate(assetRequest.Asset); PropExperience spawnedExperience = experience.GetComponent <PropExperience>(); spawnedExperience.InstanceId = worldItem.Id.Id.ToString(); spawnedExperience.OwnerId = worldItem.CreatorId; spawnedExperience.IsOwnerLocalPlayer = dataEntityCollection.LocalPlayerSessionId == worldItem.CreatorId; spawnedExperience.PropDef = Props[worldItem.Type]; spawnedExperience.transform.position = position; spawnedExperience.StartExperience(); }
private IEnumerator loadPlayerHeldExperience(PlayerHeldItem playerHeldItem) { AssetRequest <GameObject> assetRequest = Content.LoadAsync(getPropExperiencePathFromPropId(playerHeldItem.Type)); yield return(assetRequest); GameObject experience = UnityEngine.Object.Instantiate(assetRequest.Asset); PropExperience spawnedExperience = experience.GetComponent <PropExperience>(); if (spawnedExperience != null) { spawnedExperience.InstanceId = playerHeldItem.CreatorId.ToString(); spawnedExperience.OwnerId = playerHeldItem.CreatorId; spawnedExperience.IsOwnerLocalPlayer = dataEntityCollection.LocalPlayerSessionId == playerHeldItem.CreatorId; spawnedExperience.PropDef = Props[playerHeldItem.Type]; GameObject playerObject = getPlayerObject(playerHeldItem.CreatorId); if (!(playerObject == null)) { spawnedExperience.transform.SetParent(playerObject.transform, worldPositionStays: false); spawnedExperience.StartExperience(); } } }