Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (Ending)
     {
         fading.Fade(Color.black, 0.0f);
     }
 }
    private IEnumerator WaitFrameThenUnfade()
    {
        yield return(0);

        // Start at the fade color, then unfade.
        fadeReference.Fade(fadeColor, 0f);
        fadeReference.Unfade(unfadeSpeed);
    }
Example #3
0
        public virtual IEnumerator OnPhaseStart()
        {
            fade.Fade(Color.black, .25f);
            yield return(new WaitForSeconds(.25f));

            for (int i = 0; i < EnableOnStart.Count; i++)
            {
                EnableOnStart[i].SetActive(true);
            }

            RigMover.transform.position = transform.position;
            fade.Fade(Color.clear, .25f);

            yield return(null);
        }
Example #4
0
    public IEnumerator endgame()
    {
        StartCoroutine(vibrations());


        fading.Fade(Color.black, 0.1f);
        AkSoundEngine.StopAll();
        AkSoundEngine.PostEvent("stab", ariane);
        StartCoroutine(Generique.Generique());
        Generique.IsEnding = true;
        yield return(new WaitForSeconds(2));

        while (this.enabled == true)
        {
            yield return(new WaitForSeconds(0.5f));

            fading.Fade(Color.black, 0.1f);
        }
    }
Example #5
0
    IEnumerator switchScene(string sceneName)
    {
        VRTK_HeadsetFade headsetFade = gameObject.GetComponentInChildren <VRTK_HeadsetFade>();

        headsetFade.Fade(Color.black, Constants.FadeSpeed);
        yield return(new WaitForSeconds(Constants.FadeSpeed));

        Debug.Log("Loading Scene " + sceneName + "...");
        yield return(SceneManager.LoadSceneAsync(sceneName));

        Debug.Log("Loading Scene Done" + "...");

        headsetFade.Unfade(Constants.FadeSpeed);
        yield return(new WaitForSeconds(Constants.FadeSpeed));
    }
Example #6
0
    void Fade(bool fadeOut)
    {
        if (headsetFade == null || fadeColor.a == 0)
        {
            return;
        }

        if (fadeOut)
        {
            headsetFade.Fade(Color.black, gazeTriggerDuration);
        }
        else
        {
            headsetFade.Unfade(unfadeRate);
        }
    }
Example #7
0
    private void Start()
    {
        VRTK_HeadsetFade fade = VRTKScripts.instance.GetComponentInChildren <VRTK_HeadsetFade>();

        if (fade != null)
        {
            fade.Fade(Color.black, 0);
        }

        Transform playArea = VRTK_DeviceFinder.PlayAreaTransform();

        playArea.position = this.transform.position;
        playArea.rotation = this.transform.rotation;

        OnStart();

        if (fade != null)
        {
            fade.Unfade(0.5f);
        }
    }
 protected virtual void StartFade()
 {
     headsetFade.Fade(Color.black, 0.05f);
 }
 private void ScreenFlash()
 {
     headsetFade.Fade(Color.red, 0.2f);
     Invoke("UnScreenFlash", 0.2f);
 }
Example #10
0
    void FixedUpdate()
    {
        //for testing purposes disabled when in test scenes
        if (UnderwaterAmbience1 != null)
        {
            if (Time.time >= 0.25f && GameObject.Find("SteamVR") != null && VRTK_SDKManager.GetLoadedSDKSetup() == GameObject.Find("SteamVR").GetComponent <VRTK_SDKSetup>()) //this because the first check gives error as the colliders are created at runtime + don't wanna use this in the simulator
            {
                if (feet == null && head == null)                                                                                                                             //to prevent error when system button is pressed
                {
                    feet = headSet.transform.GetChild(3).GetChild(0).GetComponent <Collider>();                                                                               //finds the collider child for feet
                    Debug.Log(feet);
                    body = headSet.transform.GetChild(3).GetComponent <Collider>();
                    Debug.Log(body);
                    if (HeadsetFollower.activeSelf)
                    {
                        head = headSet.transform.GetChild(2).GetChild(4).GetComponent <Collider>();    //finds the collider child for head
                        Debug.Log(head);
                    }
                    else
                    {
                        head = headSet.transform.GetChild(2).GetChild(3).GetComponent <Collider>();
                        Debug.Log(head);
                    }
                }
                headsetbody = headSet.GetComponent <Rigidbody>();
            }

            if (touchedWater)
            {
                GameObject.Find("PlayArea").GetComponent <VRTK_BodyPhysics>().fallRestriction = VRTK_BodyPhysics.FallingRestrictors.AlwaysRestrict;
                if (oxygenTimer < Time.time - timeWhenGotUnderwater + oxygenTimer * 3 / 4 && headIsUnderWater)
                {
                    //Debug.Log("3/4 oxygen left");
                }
                if (oxygenTimer < Time.time - timeWhenGotUnderwater + oxygenTimer / 2 && headIsUnderWater)
                {
                    //Debug.Log("half oxygen left");
                }
                if (oxygenTimer < Time.time - timeWhenGotUnderwater + 24f && headIsUnderWater && notDrownedYet)
                {
                    //Debug.Log("24s oxygen left");
                    if (!DrowningAlertSounds.isPlaying)
                    {
                        DrowningAlertSounds.Play();
                    }
                }
                if (!UnderwaterAmbience1.isPlaying)
                {
                    UnderwaterAmbience1.Play();
                    UnderwaterAmbience2.Play();
                    UnderwaterAmbience3.Play();
                    UnderwaterAmbience4.Play();
                }
                //plays underwater ambience only when head is actually underwater
                if (headIsUnderWater)
                {
                    UnderwaterAmbience1.volume = 1;
                    UnderwaterAmbience2.volume = 1;
                    UnderwaterAmbience3.volume = 1;
                    UnderwaterAmbience4.volume = 1;
                }
                else
                {
                    UnderwaterAmbience1.volume = 0.5f;
                    UnderwaterAmbience2.volume = 0.5f;
                    UnderwaterAmbience3.volume = 0.5f;
                    UnderwaterAmbience4.volume = 0.5f;
                }

                if (oxygenTimer < Time.time - timeWhenGotUnderwater && headIsUnderWater && notDrownedYet)
                {
                    DrowningAlertSounds.Stop();
                    fader.Fade(Color.black, 1.5f);
                    notDrownedYet = false;
                    Drowned.Play();
                    Debug.Log("drowned");
                    //Debug.Log(Time.time);
                    LeftController.GetComponent <VRTK_InteractGrab>().enabled      = false;
                    LeftController.GetComponent <VRTK_ControllerEvents>().enabled  = false;
                    RightController.GetComponent <VRTK_InteractGrab>().enabled     = false;
                    RightController.GetComponent <VRTK_ControllerEvents>().enabled = false;
                    //head.GetComponent<Rigidbody>().isKinematic = false;
                    //player dies here, lose control, sink to bottom, fade to black
                }
                //Debug.Log("nogravity");
                //headsetbody.useGravity = false;
                if (headIsUnderWater)
                {
                    Physics.gravity = new Vector3(0, -2.5f, 0);
                }
                else
                {
                    Physics.gravity.Set(0, -9.81f, 0);
                }
                //headsetbody.AddForce(Physics.gravity * headsetbody.mass / 4);

                //if (headsetbody.velocity.y >= 0)
                //{
                //    Debug.Log("now changes");
                //    headsetbody.AddForce(new Vector3(0, -9, 0));
                //}
                //else
                //{
                //    return;
                //}
            }
            else if (headsetbody != null)
            {
                Physics.gravity.Set(0, -9.81f, 0);
                GameObject.Find("PlayArea").GetComponent <VRTK_BodyPhysics>().fallRestriction = VRTK_BodyPhysics.FallingRestrictors.EitherController;
                //headsetbody.useGravity = true;
                //Debug.Log("gravity");
            }

            if (WaterRises)
            {
                //while the water hasn't hit the top of the ceiling the speed remains the same
                if (!reachedTopPuzzle)
                {
                    transform.Translate(Vector3.up * 0.2f * Time.fixedDeltaTime, Space.World);
                    //Debug.Log("waterup");
                }
                //after hitting the ceiling the speed slows down until stopping eventually when it reaches the air lock to octoroom
                else
                {
                    transform.Translate(Vector3.up * 0.005f * Time.fixedDeltaTime, Space.World);
                }
            }
        }
    }
Example #11
0
 public void Fade()
 {
     fadeCount++;
     fade = true;
     headsetFade.Fade(Color.white, 3);
 }