public void TeleportCharacterControllerToKingelezCity() { Vector3 startPositionVector = startCityPosition.transform.position; //teleport to start position if (characterController) { characterController.transform.position = startPositionVector; characterController.transform.localRotation = Quaternion.Euler(0.0f, -180.0f, 0.0f); } if (startPlate != null) { startPlate.SetActive(false); } //AllianzStartPlate.SetActive(true); hasStarted = true; //BeginTimeline.Play(); //markers appear if (KingelezCityRoot != null) { KingelezCityRoot.SetActive(true); } //AkSoundEngine.PostEvent("cityVoice1", gameObject); currentTimer = levelTime[0]; StartCoroutine(MarkerScript.ScaleMarkers(null, 0, startPositionVector, markerScaleDuration, markerScaleTimeOffset, false)); }
public void TeleportCharacterController(GameObject targetMarker, Vector3 hitPoint) { MarkerScript marker = targetMarker.GetComponent <MarkerScript>(); float scale = 1.0f; if (marker) { if (marker.markerLevel == 1) //top buildings { scale = microScale; QualitySettings.shadowDistance = level1ShadowDistance; //AkSoundEngine.PostEvent("cityVoice2", gameObject); } else if (marker.markerLevel == 2) //top buildings { scale = microScale; QualitySettings.shadowDistance = level2ShadowDistance; //AkSoundEngine.PostEvent("cityVoice3", gameObject); } else if (marker.markerLevel == 3) //top buildings { scale = microScale; QualitySettings.shadowDistance = level3ShadowDistance; //AkSoundEngine.PostEvent("cityVoice4", gameObject); } else //macro scale { scale = macroScale; QualitySettings.shadowDistance = level0ShadowDistance; //play 1st voice //AkSoundEngine.PostEvent("cityVoice2", gameObject); } } else //macro scale { scale = macroScale; QualitySettings.shadowDistance = level0ShadowDistance; //play 1st voice //AkSoundEngine.PostEvent("cityVoice2", gameObject); } Vector3 flatCameraOffset = Vector3.zero; if (!UnityEngine.XR.XRSettings.isDeviceActive) { flatCameraOffset = Vector3.up * 1.7f * scale; } Vector3 newPosition = hitPoint + flatCameraOffset; if (characterController) { characterController.transform.position = newPosition; if (writeRotation) { characterController.transform.localRotation = newRotation; writeRotation = false; } // else // characterController.transform.localRotation = Quaternion.Euler(0.0f, -180.0f, 0.0f); characterController.transform.localScale = new Vector3(scale, scale, scale); } if (activeMarker) { activeMarker.SetActive(true); if (activeMarker.GetComponent <MarkerScript>().occlusionCollision != null) { activeMarker.GetComponent <MarkerScript>().occlusionCollision.gameObject.SetActive(true); } } activeMarker = targetMarker; activeMarker.SetActive(false); if (marker.occlusionCollision != null) { marker.occlusionCollision.gameObject.SetActive(false); } StartCoroutine(MarkerScript.ScaleMarkers(marker, currentMarkerLevel, newPosition, markerScaleDuration, markerScaleTimeOffset, marker.markerLevel != 0)); }