Example #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         SteamVR_Fade.View(Color.black, 0);
         SteamVR_Fade.View(Color.clear, 1);
     }
 }
Example #2
0
    /// <summary>
    /// 将Player传送到destination位置
    /// </summary>
    public void transformObject()
    {
        SteamVR_Fade.View(Color.black, 0);
        SteamVR_Fade.View(Color.clear, 2.0f);
        Vector3 tmp = destination.position - VRCamera.transform.localPosition;

        player.position = new Vector3(tmp.x, player.position.y, tmp.z);
    }
Example #3
0
 private void FadeFromWhite()
 {
     // Debug.Log("FadeFromWhite");
     //set start color
     SteamVR_Fade.View(fadeColor, 0f);
     //set and start fade to
     SteamVR_Fade.View(Color.clear, fadeDuration);
 }
Example #4
0
    private void Teleport()
    {
        Vector3 difference = cameraRigTransform.position - headTransform.position;

        difference.y = 0;
        cameraRigTransform.position = nextRoomLocation + difference;
        SteamVR_Fade.View(Color.clear, 1f);
        teleport = true;
    }
Example #5
0
    public IEnumerator MoveRig(Transform CameraRig, Vector3 Translate)
    {
        SteamVR_Fade.View(Color.black, FadeDuration);
        yield return(new WaitForSeconds(FadeDuration));

        CameraRig.position += Translate;
        SteamVR_Fade.View(Color.clear, FadeDuration);
        IsTeleporting = false;
    }
Example #6
0
    public IEnumerator SetLevel(int level, int difficulty, bool delay)
    {
        if (delay && HMDActive)
        {
            SteamVR_Fade.View(Color.black, FadeOutTime);
            Invoke("FadeIn", FadeOutTime);
            yield return(new WaitForSeconds(FadeOutTime));
        }

        EnableObjects(level, levelCameras);
        EnableObjects(level, levelObjects);
        SetSkybox(level);
        Level = level;
        CancelInvoke("BlinkRandomizer");
        CancelInvoke("Blink");
        switch (level)
        {
        case 0:
            PlayerVehicle.SetActive(false);
            Terrain.SetActive(false);
            RoadNetwork.SetActive(false);
            RenderSettings.fogDensity = 0;
            break;

        case 1:
            PlayerVehicle.SetActive(true);
            Terrain.SetActive(true);
            RoadNetwork.SetActive(true);
            SetVehiclePosition(Level1Start);
            RenderSettings.ambientIntensity = 0;
            RenderSettings.fogDensity       = 0.0005f;
            break;

        case 2:
            PlayerVehicle.SetActive(true);
            Terrain.SetActive(true);
            RoadNetwork.SetActive(true);
            SetVehiclePosition(Level2Start);
            TriggerLevelTwoWithDifficulty(difficulty);
            RenderSettings.ambientIntensity = -2;
            RenderSettings.fogDensity       = 0.005f;
            break;

        case 3:
            PlayerVehicle.SetActive(false);
            Terrain.SetActive(false);
            RoadNetwork.SetActive(false);
            RenderSettings.fogDensity = 0;
            break;
        }

        if (OnLevelChanged != null)
        {
            print("Level Changing Fire");
            OnLevelChanged(level);
        }
    }
Example #7
0
    private void Teleport()
    {
        shouldTeleport = false;
        //     locationSpot.SetActive(false);
        Vector3 difference = cameraRigTransform.position - headTransform.position;

        difference.y = 0;
        cameraRigTransform.position = nextRoomLocation + difference;
        SteamVR_Fade.View(Color.clear, 1f);
    }
Example #8
0
    private void Start()
    {
        Time.timeScale = 1;
        //Set Cursor to not be visible
        Cursor.visible = false;
        // Lock cursor on the window
        Cursor.lockState = CursorLockMode.Locked;

        SteamVR_Fade.View(Color.clear, 2);
    }
Example #9
0
    private void Teleport()
    {
        canTeleport = false;
        reticle.SetActive(false);
        Vector3 difference = cameraRigTransform.position - headTransform.position;

        difference.y = 0;
        cameraRigTransform.position = movePoint + difference;
        SteamVR_Fade.View(new Color(0, 0, 0, 0), 2f);
    }
Example #10
0
 void UpdateFade()
 {
     if (colliders.Count == 0)
     {
         SteamVR_Fade.View(Color.clear, transitionTime);
     }
     else
     {
         SteamVR_Fade.View(Color.black, transitionTime);
     }
 }
Example #11
0
    public void RestartLevel()
    {
        Color color = new Color(0, 0, 0, 0);

        SteamVR_Fade.View(color, 1);

        ToggleGame(false);
        loadingScene = SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
        loadingScene.allowSceneActivation = false;
        StartCoroutine(AllowToLoadScene());
    }
Example #12
0
    /// <summary>
    /// event for trigger pull
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void triggerConfirm(object sender, ClickedEventArgs e)
    {
        if (Button != null)
        {
            switch (Button.GetComponent <ButtonInteraction>().BID)
            {
            case ButtonInteraction.buttonID.SCENARIOS:
                //swap to scenarios menu
                menuTransition(MENU.SCENARIO);
                Button = null;
                break;

            case ButtonInteraction.buttonID.SCENARIO:
                currentScenarioID = Button.GetComponent <ButtonInteraction>().ScenarioID;
                Button            = null;
                SteamVR_Fade.View(Color.black, 1.25f);
                Invoke("LoadScenario", 1f);
                break;

            case ButtonInteraction.buttonID.RANGE:
                Button = null;
                SteamVR_Fade.View(Color.black, 1.25f);
                Invoke("LoadRange", 1f);
                break;

            case ButtonInteraction.buttonID.QUIT:
#if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
#else
                Application.Quit();
#endif
                break;

            case ButtonInteraction.buttonID.BACK:
                if (currentMenu == MENU.SCENARIO)
                {
                    menuTransition(MENU.MAIN);
                    Button = null;
                }
                else if (currentMenu == MENU.INSTRUCTION)
                {
                    menuTransition(MENU.SCENARIO);
                    Button = null;
                }
                break;

            case ButtonInteraction.buttonID.INSTRUCTIONS:
                menuTransition(MENU.INSTRUCTION);
                Button = null;
                break;
            }
        }
    }
Example #13
0
    /// <summary>
    /// Fades in
    /// </summary>
    /// <param name="target">Target GameObject</param>
    /// <returns></returns>
    IEnumerator FadeIn(GameObject target)
    {
        if (target.GetComponent <CharacterController>() != null)
        {
            target.GetComponent <CharacterController>().enabled = false;
            target.transform.position = m_destination.position;
            target.GetComponent <CharacterController>().enabled = true;
        }
        yield return(new WaitForSeconds(0f));

        SteamVR_Fade.View(Color.clear, 1);
    }
Example #14
0
    // Update is called once per frame
    void Update()
    {
        currentinstructionTime = Time.time - instructionTimerStart;
        float currentTime = Time.time;

        if (nextIndexToPlay < instructionTimer.Length && currentTime > instructionTimer[nextIndexToPlay] && lastTime <= instructionTimer[nextIndexToPlay])
        {
            instructionaudio.clip = instructions[nextIndexToPlay];
            instructionaudio.Play();
            nextIndexToPlay++;
        }

        lastTime = currentTime;

        if (Time.time <= instructionTimer[2] - 0.9f && Time.time > instructionTimer[1] + 2.2f)
        {
            Reading = true;
        }
        else
        {
            Reading = false;
        }

        if (Time.time > instructionTimer[6] - 5.0f)
        {
            WOZ2 = true;
        }
        else
        {
            WOZ2 = false;
        }

        if (Time.time > instructionTimer[2] + 0.5)
        {
            WOZ = true;
        }
        else
        {
            WOZ = false;
        }

        if (Time.time > instructionTimer[5] - 1.3f)
        {
            dataShow.SetActive(true);
        }
        if (SceneNo < 9 && Time.time > instructionTimer[8] + 5.0f)
        {
            SteamVR_Fade.Start(Color.clear, 0.0f);
            SteamVR_Fade.View(Color.clear, 0.1f);
            SceneManager.LoadScene(SceneNo);
        }
    }
Example #15
0
    /// <summary>
    /// Fades the camera to black then back to clear for the dimension jump
    /// Based off Cameron's fade to white method in FadeCamera Class
    /// </summary>
    /// <see cref="FadeCamera.FadeToWhite"/>
    /// <returns>a yield return that waits for 0.5 seconds to allow for fade of camera</returns>
    private IEnumerator StartCameraFade()
    {
        //set start color
        SteamVR_Fade.View(Color.clear, 0f);

        //fade to black
        SteamVR_Fade.View(fadeColor, fadeDuration);

        //Wait for the fade to complete
        yield return(new WaitForSeconds(0.35f));

        //fade back to clear
        SteamVR_Fade.View(Color.clear, fadeDuration);
    }
        protected override void Update()
        {
            base.Update();
            if (SceneOff)
            {
                SceneOffTimer += Time.deltaTime;

                // after a certain time, the scene fades in with the provided duration
                if (SceneOffTimer >= SceneOffDuration)
                {
                    SteamVR_Fade.View(Color.clear, FadeInDuration);
                    SceneOff      = false;
                    SceneOffTimer = 0.0f;
                }
            }
        }
Example #17
0
    public IEnumerator StartNextTask()
    {
        yield return(new WaitForSeconds(5f));

        SteamVR_Fade.View(Color.black, fadeTime);
        yield return(new WaitForSeconds(fadeTime));

        instructionCanvas.gameObject.SetActive(true);
        extinguisherCanvas.gameObject.SetActive(true);
        scenarioManager.PickNextTask();
        scenarioManager.SetupTask();
        scenarioManager.PlayerPosResetter.ResetPosition();
        SteamVR_Fade.View(Color.clear, fadeTime);
        fireVFX.ResetTimer();
        ActivateLaserPointers();
        gameObject.SetActive(false);
    }
    /// <summary>
    /// event for trigger being pulled
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void triggerConfirm(object sender, ClickedEventArgs e)
    {
        if (Button != null)
        {
            switch (Button.GetComponent <ButtonInteraction>().BID)
            {
            case ButtonInteraction.buttonID.PAUSE:
                PauseAndResume();
                Button = null;
                break;

            case ButtonInteraction.buttonID.EXIT:
                SteamVR_Fade.View(Color.black, 1.25f);
                Time.timeScale = 1;
                Invoke("LoadMainMenu", 1.5f);
                break;

            case ButtonInteraction.buttonID.START:
                statusText.text = "Targets started";
                TC.startTargetSequence();
                break;

            case ButtonInteraction.buttonID.STOP:
                TC.stopTargetSequence();
                statusText.text = "Targets stopped";
                break;

            case ButtonInteraction.buttonID.RESET:
                if (!TC.IsRunning)
                {
                    TC.resetTargetSequence();
                    statusText.text = "Targets reset";
                }
                break;

            case ButtonInteraction.buttonID.EXIT_SCENARIO:
                GetComponent <ScenarioController>().ExitScenario = true;
                break;
            }
        }
    }
Example #19
0
    // 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;
            }
        }
    }
Example #20
0
    // 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);
        }
    }
Example #21
0
    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");
    }
        /// <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));
                }
            }
        }
Example #23
0
    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);
    }
Example #24
0
    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;
        }
    }
Example #25
0
 void OnTriggerEnter()
 {
     SteamVR_Fade.View(Color.black, .5f);
     Invoke("reloadLevel", .5f);
 }
Example #26
0
 void reloadLevel()
 {
     SteamVR_Fade.View(Color.clear, .5f);
     Application.LoadLevel(Application.loadedLevel);
 }
Example #27
0
 /// <summary>
 /// things to do upon scene loading
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="lsm"></param>
 public void sceneLoad(Scene scene, LoadSceneMode lsm)
 {
     SteamVR_Fade.View(Color.clear, 2f);
 }
 /// <summary>
 /// Exit voice command triggered, load the main menu
 /// </summary>
 public void ExitCalled()
 {
     SteamVR_Fade.View(Color.black, 1.25f);
     Time.timeScale = 1;
     Invoke("LoadMainMenu", 1.5f);
 }
Example #29
0
 public void LoadTutorial()
 {
     SteamVR_Fade.View(Color.clear, 0);
     SteamVR_Fade.View(Color.black, 1);
     SteamVR_LoadLevel.Begin("Tutorial");
 }
 void moveToWallOSettings()
 {
     armSwinger.moveCameraRig(new Vector3(30.5f, 0, 11.695f));
     SteamVR_Fade.View(Color.clear, .5f);
 }