private IEnumerator IEfadeStart() { yield return(new WaitForSeconds(12.5f)); SteamVR_Fade.Start(Color.black, fadeTime, true); yield return(new WaitForSeconds(fadeTime)); controllerGrp.transform.position = Vector3.zero; Controller.Instance.IsTitle = false; Controller.Instance.ControllerModelRight.SetActive(true); Controller.Instance.ControllerBallRight.GetComponent <MeshRenderer>().enabled = true; Controller.Instance.ControllerBallRight.GetComponent <TrailRenderer>().enabled = true; Controller.Instance.ControllerModelLeft.SetActive(true); Controller.Instance.ControllerBallLeft.GetComponent <MeshRenderer>().enabled = true; Controller.Instance.ControllerBallLeft.GetComponent <TrailRenderer>().enabled = true; transform.parent.gameObject.SetActive(false); pointer.SetActive(true); SteamVR_Fade.Start(Color.clear, fadeTime, true); }
void InitiateTeleportFade() { teleporting = true; bool doFade = true; currentFadeTime = teleportFadeTime; TeleportPoint teleportPoint = teleportingToMarker as TeleportPoint; if (teleportPoint != null && teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene) { currentFadeTime *= 3.0f; } else { if (fastTeleport) { doFade = false; teleportStartPosition = Player.instance.trackingOriginTransform.position; teleportLerp = 0; Player.instance.GetComponent <CharacterController>().enabled = false; } } if (doFade) { SteamVR_Fade.Start(Color.clear, 0); SteamVR_Fade.Start(Color.black, currentFadeTime); } headAudioSource.transform.SetParent(Player.instance.hmdTransform); headAudioSource.transform.localPosition = Vector3.zero; PlayAudioClip(headAudioSource, teleportSound); if (doFade) { Invoke("TeleportPlayer", currentFadeTime); } }
// Update is called once per frame void Update() { if (!disableShoot) { RaycastHit hit = new RaycastHit(); Ray shot = new Ray(Barrel.transform.position, Parent.transform.forward); bool contact = Physics.Raycast(shot, out hit); if (_fireAction.GetStateDown(_pose.inputSource) && contact) { if (hit.collider.tag == "NOTLD") { disableShoot = true; GunShot.Play(); StartCoroutine(FadeOutMusic(MainSong, 2)); SteamVR_Fade.View(Color.black, 3); StartCoroutine(WaitForSceneLoad("NotLD")); } else if (hit.collider.tag == "MenuItem") { hit.transform.GetComponent <IMenuItem>().Activate(); } } else if (_fireAction.GetStateDown(_pose.inputSource)) { GunClick.Play(); } else if (contact) { if (hit.collider.tag == "NOTLD") { NotlLight.intensity = 1000; } } else { NotlLight.intensity = 250; } } }
public IEnumerator StartTeleport(Vector3 position, float duration) { var halfDuration = Mathf.Max(0f, duration * 0.5f); if (!Mathf.Approximately(halfDuration, 0f)) { if (!m_steamVRFadeInitialized) { // add SteamVR_Fade to the last rendered stereo camera var fadeScripts = FindObjectsOfType <SteamVR_Fade>(); if (fadeScripts == null || fadeScripts.Length <= 0) { var topCam = SteamVR_Render.Top(); if (topCam != null) { topCam.gameObject.AddComponent <SteamVR_Fade>(); } } m_steamVRFadeInitialized = true; } SteamVR_Fade.Start(new Color(0f, 0f, 0f, 1f), halfDuration); yield return(new WaitForSeconds(halfDuration)); yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position target.position = position; SteamVR_Fade.Start(new Color(0f, 0f, 0f, 0f), halfDuration); yield return(new WaitForSeconds(halfDuration)); } else { yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position target.position = position; } teleportCoroutine = null; }
IEnumerator endTutorial() { yield return(new WaitForSeconds(0.5f)); PlayClip(); // 11 leftTooltip.UpdateText(gripTooltip, "Walk"); rightTooltip.UpdateText(gripTooltip, "Walk"); leftTooltip.UpdateText(triggerTooltip, "Grab"); rightTooltip.UpdateText(triggerTooltip, "Grab"); leftTooltip.UpdateText(touchpadTooltip, "Teleport"); rightTooltip.UpdateText(touchpadTooltip, "Interact"); yield return(new WaitForSeconds(voiceOvers[currClip].length)); SteamVR_Fade.View(Color.clear, 0); SteamVR_Fade.View(Color.black, 1); PlayClip(); // 12 aka Game Start yield return(new WaitForSeconds(voiceOvers[currClip].length + 1)); SteamVR_LoadLevel.Begin("Puzzle"); }
//------------------------------------------------- private void InitiateTeleportFade() { teleporting = true; currentFadeTime = teleportFadeTime; TeleportPoint teleportPoint = teleportingToMarker as TeleportPoint; if ( teleportPoint != null && teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene ) { currentFadeTime *= 3.0f; Teleport.ChangeScene.Send( currentFadeTime ); } SteamVR_Fade.Start( Color.clear, 0 ); SteamVR_Fade.Start( Color.black, currentFadeTime ); headAudioSource.transform.SetParent( player.hmdTransform ); headAudioSource.transform.localPosition = Vector3.zero; PlayAudioClip( headAudioSource, teleportSound ); Invoke( "TeleportPlayer", currentFadeTime ); }
// Update is called once per frame void Update() { if (Controller.GetTouch(SteamVR_Controller.ButtonMask.Touchpad) && roomCleared == true) { RaycastHit hit; if (Physics.Raycast(trackedObj.transform.position, transform.forward, out hit, 100, teleportMask)) { laserPoint = hit.point; ShowLaser(hit); door = null; if (Physics.Raycast(trackedObj.transform.position, transform.forward, out hit, 100, teleportDoorMask)) { door = hit.collider.gameObject; // door.GetComponent<Door> ().z; // Debug.Log (door.GetComponent<Door> ().z); nextRoomZ = door.transform.position.z - 8f; nextRoomX = door.transform.position.x; nextRoomLocation = new Vector3(nextRoomX, 0f, nextRoomZ); shouldTeleport = true; } // locationSpot.SetActive(true); // teleportReticleTransform.position = laserPoint + teleportTargetOffset; } } else { laser.SetActive(false); // locationSpot.SetActive(false); } if (Controller.GetPress(SteamVR_Controller.ButtonMask.Touchpad) && shouldTeleport) { SteamVR_Fade.View(Color.black, 1f); Invoke("Teleport", 1f); } }
private IEnumerator MoveRig(Transform CameraRig, Vector3 translation) { //Flag m_IsTeleporting = true; //Fade to black SteamVR_Fade.Start(Color.black, m_FadeTime, true); //Apply translation yield return(new WaitForSeconds(m_FadeTime)); CameraRig.position += translation; //Fade to clear SteamVR_Fade.Start(Color.clear, m_FadeTime, true); //De-flag m_IsTeleporting = false; yield return(null); }
private void OnTriggerExit(Collider other) { /*Fade The Camera Back to World and Stop Video*/ if (other.gameObject.tag == "Head") { print("ON STOP TRIGGER EXIT"); if (corout != null) { StopCoroutine(corout); } SteamVR_Fade.Start(Color.clear, 1.0f); GameObject ozo_cam = GameObject.Find("OZO_Camera"); PlayControl player = ozo_cam.GetComponentInChildren <PlayControl>(); player._play.SetVisible(false); player._startPlay = false; player._play.Stop(); Camera.allCameras[0].cullingMask = -1; } }
IEnumerator DeathOpening() { startGameGroup.gameObject.SetActive(false); yield return(new WaitForSeconds(1)); SteamVR_Fade.Start(Color.black, 3f); // fade the headset to black yield return(new WaitForSeconds(4)); TeleportBrute(theVoid); PlayTitle("Death"); yield return(new WaitForSeconds(8)); TeleportBrute(DeathStart); SteamVR_Fade.Start(Color.clear, 4f); // fade the headset to clear SetChapter(G.chapterType.death); }
public IEnumerator LoadGame() { yield return(new WaitForSeconds(waitTime)); SteamVR_Fade.Start(color, fadeTime); if (stopMusic) { AudioSource music; GameObject go = GameObject.FindGameObjectWithTag("music"); music = go.GetComponent <AudioSource>(); StartCoroutine(StopMusic(go, music)); } yield return(new WaitForSeconds(fadeTime)); AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneToLoad); Destroy(player); while (!asyncLoad.isDone) { yield return(null); } }
protected override void Update() { base.Update(); if (open) { transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(openRotation), Time.deltaTime * smooth); time += Time.deltaTime; //ホワイトアウト処理 SteamVR_Fade.Start(Color.white, 2f); //ホワイトアウト終了後メインシーンへ if (time > 2) { SceneManager.LoadScene("Clear"); } } else { transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(defaultRotation), Time.deltaTime * smooth); } }
/// <summary> /// Teleports a player to the destination set. /// </summary> public void TeleportPlayer() { SteamVR_Fade.Start(Color.clear, 0.2f); var pgo = GameObject.FindWithTag("Player"); if (pgo == null) { Debug.LogWarning("No player found!"); } var player = pgo.GetComponent <Player>(); if (player == null) { Debug.LogWarning("No SteamVR Player attached!"); } var playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess; player.trackingOriginTransform.position = destination + playerFeetOffset; }
override public void Activate(AbstractGameState previousState) { base.Activate(previousState); const float fadeDuration = 1f; SteamVR_Fade.Start(Color.black, 0); DOVirtual.DelayedCall(1 + fadeDuration, () => { SteamVR_Fade.Start(Color.clear, fadeDuration); if (Application.isEditor && skipToAssignment != Assignments.NO_CHEAT) { context.SetSailToAssignmentState((int)skipToAssignment, 1f); } else { context.StateMachine.SetState(new GameStateNavigatorIntro(context)); } }); }
/// <summary> /// Called when the travel should be performed /// </summary> /// <param name="e">ControllerActionEventArgs</param> public override void OnTravel(VRIL_ControllerActionEventArgs e) { if (IsActivated && !DelayToNextTravel) { // if a valid position is selected, travel is triggered if (PositionSelected) { PlayAudio(); SaveDistancesToViewpoint(); Viewpoint.transform.position = TargetPosition; TransferSelectedObjects(); PositionSelected = false; Timer = 0.0f; DelayToNextTravel = true; // blink scene away immediately if (SceneBlinksAway) { SteamVR_Fade.View(SceneOffColor, 0); SceneOff = true; } } if (HitEntity != null) { HitEntity.SetActive(false); } IsActivated = false; // in case travel does not disabled technique, selection mode is actived again if (!TravelDisablesTechnique) { IsActivated = true; StartCoroutine(SelectPosition(e)); } } }
private void Update() { ray = new Ray(tr.position, tr.forward); if (Physics.Raycast(ray, out hit, distance)) { line.SetPosition(1, new Vector3(0, 0, hit.distance)); pointerTr.position = hit.point + (hit.normal * 0.01f); pointerTr.rotation = Quaternion.LookRotation(hit.normal); currButton = hit.collider.gameObject; if (currButton != prevButton) { ExecuteEvents.Execute(currButton , new PointerEventData(EventSystem.current) , ExecuteEvents.pointerEnterHandler); ExecuteEvents.Execute(prevButton , new PointerEventData(EventSystem.current) , ExecuteEvents.pointerExitHandler); prevButton = currButton; } if (trigger.GetStateDown(hand)) { ExecuteEvents.Execute(currButton , new PointerEventData(EventSystem.current) , ExecuteEvents.pointerClickHandler); } } if (teleport.GetLastStateUp(hand)) { SteamVR_Fade.Start(Color.black, 0.0f); StartCoroutine(this.Teleporting(hit.point)); } }
// Update is called once per frame void Update() { // point ++; //Debug.Log(state); if (point < 5) { //どんぐり state = 0; } else if (point >= 5 && point < 15) { //うさぎ state = 1; } else if (point >= 15 && point < 35) { //きつね state = 2; } else if (point >= 35 && point < 75) { //おおかみ state = 3; } else if (point >= 75 && point < 775) { //くま state = 4; } else if (point >= 775) { state = 5; Timeflag = 1; SteamVR_Fade.Start(Color.white, 1f); Invoke("finish", 2); } }
private IEnumerator FinishSpeaking() { float delay = 1.0f; companion.SetAutoFollow(false); companion.SetIdle(false); companion.MoveTo(companionPosition.position); yield return(new WaitForSeconds(3.0f)); companion.StartSpeaking(audioClips[0]); yield return(new WaitForSeconds(audioClips[0].length + delay)); yield return(new WaitForSeconds(7.0f)); companion.StartSpeaking(audioClips[1]); yield return(new WaitForSeconds(audioClips[1].length + delay)); SteamVR_Fade.Start(Color.black, 3.0f); yield return(null); }
/// <summary> /// Change Player transform between fading out and back in. /// </summary> /// <param name="newTransform">Transform of transport destination.</param> /// /// <param name="currMenuGO">Gameobject of current menu.</param> /// /// <param name="newTransform">Gameobject of next menu.</param> public void Transport(Transform newTransform, GameObject currMenuGO, GameObject nextMenuGO) { SteamVR_Fade.Start(Color.clear, 0.0f); SteamVR_Fade.Start(fadeColor, transitionLength / 2.0f); currMenuGO.SetActive(false); nextMenuGO.SetActive(true); FindObjectOfType <ReferenceManager>().talkingParticle.MovePosition(nextMenuGO.name); player.transform.position = newTransform.position; player.transform.rotation = newTransform.rotation; player.transform.localScale = newTransform.localScale; SteamVR_LaserPointer[] pointers = player.GetComponentsInChildren <SteamVR_LaserPointer>(); foreach (SteamVR_LaserPointer pointer in pointers) { pointer.playerScale = newTransform.localScale.x; } SteamVR_Fade.Start(fadeColor, 0.0f); SteamVR_Fade.Start(Color.clear, transitionLength / 2.0f); }
// Use this for initialization void Update() { if (startTimer == true) { timer += Time.deltaTime; if (timer > waitTime) { calibrationCell.SetActive(false); mapCell0.SetActive(false); startingCell.SetActive(true); map.SetActive(true); SteamVR_Fade.Start(Color.clear, 1); //TestManager.instance.OpenIOStream(); TestManager.instance.startTimer = true; timer = 0; startTimer = false; //transform.position - GameObject.FindGameObjectWithTag("Player").transform.position; GameObject mimic = GameObject.FindGameObjectWithTag("Mimic"); mimic.transform.position = GameObject.FindGameObjectWithTag("Player").transform.position + map.transform.position; ui.SetActive(false); } } }
void Update() { if (Physics.Raycast(tr.position, tr.forward, out hit, distance)) //시작좌표. 광선의 방향(0.0.1), 맞은 오브젝트의 정보, 광선의 거리 { line.SetPosition(1, new Vector3(0, 0, hit.distance)); //라인 렌더러의 끝점을 오브젝트의 거리 까지만 한다. pointer.transform.position = hit.point + (hit.normal * 0.01f); pointer.transform.rotation = Quaternion.LookRotation(hit.normal);// 물체와 부딧 } else { pointer.transform.position = tr.position + (tr.forward * distance); //하늘을 바라봤을 때 수직으로보게한다 pointer.transform.rotation = Quaternion.LookRotation(tr.forward); //올일러를 하면 오류가있을수있음 벡터의 각도를 쿼터니온 각도로 변환해서 넣어준다. } if (teleport.GetStateDown(hands) && Physics.Raycast(tr.position, tr.forward, out hit, distance, 1 << 8)) //왼손 { SteamVR_Fade.Start(Color.black, 0.0f); // 바뀔 색, 바뀔 시간, //Sleep StartCoroutine(Teleport(hit.point)); //힛된 지점을 넘기고 } }
private void InitializeHeadPositioningIntro(IScene tutorialScene, int stageIndex) { var uiIntroNode = tutorialScene.EnumerateAllNodes().Single(x => x.Name == "Head Positioning"); stageRoomIds[stageIndex] = uiIntroNode.Id; var playerSpawn = uiIntroNode.SearchComponent <IFocusNodeComponent>().DefaultViewpointMechanism.FixedCamera.GetProps().Frame; CreateRoomStartTrigger(playerSpawn.Eye.ToUnity(), VrInputDispatcherCapabilities.None, typeof(FixedTeleportVrNavigationMode)); //Transition to next room var nextButtonPosition = playerSpawn.Eye.ToUnity() + new Vector3(0.0f, -1f, -0.7f); var nextButtonRotation = Quaternion.AngleAxis(180.0f, Vector3.up); var nextButtonText = "Press Me!"; var nextButtonObj = CreateButton(nextButtonPosition, nextButtonRotation, nextButtonText, () => { SteamVR_Fade.Start(Color.white, 0); navigationService.GoToSpecific(stageRoomIds[stageIndex + 1]); headPositionService.ResetHeadPosition(); SteamVR_Fade.Start(Color.clear, 0.5f); }); cleanUpList.Add(nextButtonObj); }
/// <summary> /// Uses controller input to adjust the value of the weirdness rating. /// When trigger is pressed, writes value to file and launches next phase. /// </summary> void Update() { if (Controller.GetAxis().y > 0.0f || Input.GetKey("up")) { if (slider.value <= 100) { slider.value += 30 * Time.deltaTime; } } else if (Controller.GetAxis().y < 0.0f || Input.GetKey("down")) { if (slider.value >= 0) { slider.value -= 30 * Time.deltaTime; } } else if (Controller.GetHairTrigger() || Input.GetKey("r")) { SteamVR_Fade.Start(Color.black, 0.1f); SteamVR_Fade.Start(Color.clear, 1.2f); Utils.writeToFile("Assets/" + userID + Convert.ToString(EXPERIMENT) + "Weirdness.txt", Convert.ToString(slider.value)); SceneManager.LoadScene("Redirected Walking Scene"); } }
private IEnumerator LastPos() { SteamVR_Fade.Start(Color.black, 2f, true); yield return(new WaitForSeconds(2.0f)); Debug.Log("Game Clear"); SteamVR_Fade.Start(Color.clear, 2f, true); RigCamera = GameObject.Find("[CameraRig]"); EnddingGo = GameObject.Find("NewPaper_Ending"); test1 = GameObject.Find("TeleportCube"); test2 = GameObject.Find("Camera (eye)"); RigCamera.GetComponent <CapsuleCollider>().enabled = false; RigCamera.GetComponent <Rigidbody>().useGravity = false; RigCamera.transform.position = new Vector3(10000f, 10000f, 10000f); test1.transform.position = test2.transform.position; EnddingGo.transform.parent = test2.transform; EnddingGo.transform.Translate(-Vector3.forward * 2); yield break; }
public IEnumerator StartTeleport(Vector3 position, float duration) { var halfDuration = Mathf.Max(0f, duration * 0.5f); if (!Mathf.Approximately(halfDuration, 0f)) { SteamVR_Fade.Start(new Color(0f, 0f, 0f, 1f), halfDuration); yield return(new WaitForSeconds(halfDuration)); yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position target.position = position; SteamVR_Fade.Start(new Color(0f, 0f, 0f, 0f), halfDuration); yield return(new WaitForSeconds(halfDuration)); } else { yield return(new WaitForEndOfFrame()); // to avoid from rendering guideline in wrong position target.position = position; } teleportCoroutine = null; }
// Update is called once per frame void Update() { triggerButtonDown = controller.GetPressDown(triggerButton); triggerButtonUp = controller.GetPressUp(triggerButton); triggerButtonDown = controller.GetPress(triggerButton); Debug.DrawRay(transform.position, GunEnd.transform.forward, Color.green); if (triggerButtonDown && Time.time > WaitTime) { SteamVR_Fade.Start(Color.black, 0); SteamVR_Fade.Start(Color.clear, 1); Source.PlayOneShot(GunNoise); WaitTime = Time.time + FireRate; //Firing Cooldown time RaycastHit hit; if (Physics.Raycast(transform.position, GunEnd.transform.forward, out hit)) { Source.PlayOneShot(HitNoise); hit.transform.SendMessage("HitByRay"); } } if (triggerButtonDown) { print("hello2"); } }
IEnumerator startStory() { bgmOff.TransitionTo(1); SteamVR_Fade.View(Color.clear, 0); SteamVR_Fade.View(Color.black, 1); yield return(new WaitForSeconds(2)); bgm.Pause(); story.Play(); yield return(new WaitForSeconds(storyLength + 2)); masterOff.TransitionTo(1); yield return(new WaitForSeconds(1)); SkipStory(); bgmOn.TransitionTo(1); bgm.Play(); story.Pause(); SteamVR_Fade.View(Color.black, 0); SteamVR_Fade.View(Color.clear, 1); }
protected virtual void Blink(float transitionSpeed) { fadeInTime = transitionSpeed; SteamVR_Fade.Start(Color.black, 0); Invoke("ReleaseBlink", blinkPause); }
void Update() { if (playerHealthScript.currentHealth <= 0) { //teleport SteamVR_Fade.View(Color.black, 3f); //destroy ememies var clones = GameObject.FindGameObjectsWithTag("EnemyClones"); foreach (var item in clones) { Destroy(item); } WeaponGrabRight.swordInHand = false; WeaponGrabRight.crossbowInHand = false; WeaponGrabLeft.swordInHand = false; WeaponGrabLeft.crossbowInHand = false; Crossbow.GetComponent <Rigidbody> ().isKinematic = false; Sword.GetComponent <Rigidbody> ().isKinematic = false; CountTextScript.roomNumber = 0; CountTextScript.remaining = 0; //CountTextScript.ememiesText.text = "Ememies Remaining: " + remaining.ToString(); //true with out tutorial CountTextScript.room1Entered = false; CountTextScript.room1Cleared = false; CountTextScript.room2Entered = false; CountTextScript.room2Cleared = false; CountTextScript.room3Entered = false; CountTextScript.room3Cleared = false; CountTextScript.room4Entered = false; CountTextScript.room4Cleared = false; CountTextScript.room5Audio = false; CountTextScript.winRoomEntered = false; TeleportCubeScript.nextRoomLocation = new Vector3(0f, 0f, 35f); TeleportCubeScript.Invoke("Teleport", 3f); //health playerHealthScript.currentHealth = 10; redbarHealth.transform.localScale = new Vector3(1.1f, 1f, 1f); playerHealthScript.takingDMG = 0; playerHealthScript.gotHit = false; playerHealthScript.playerDamage = false; playerHealthScript.playerAlive = true; //playerHealthScript. //weapons Crossbow.transform.position = new Vector3(0f, 1.7f, 4.25f); Crossbow.transform.rotation = Quaternion.identity; Sword.transform.position = new Vector3(21f, 3.02f, -28.31f); Sword.transform.rotation = Quaternion.identity; } }
private void ReleaseBlink() { SteamVR_Fade.Start(Color.clear, fadeInTime); fadeInTime = 0f; }