Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.isTrigger)
        {
            return;
        }

        Color fadeBlack = new Color(0.0f, 0.0f, 0.0f, 0.99f);

        SteamVR_Fade.Start(fadeBlack, fadeToBlackTime);
    }
    private IEnumerator Move(Transform camRig, Vector3 translation)
    {
        _isTeleporting = true;
        SteamVR_Fade.Start(Color.black, _fadeTime, true);

        yield return(new WaitForSeconds(_fadeTime));

        camRig.position += translation;
        SteamVR_Fade.Start(Color.clear, _fadeTime, true);
        _isTeleporting = false;
    }
Example #3
0
    public static void Tele(Transform pointer, Transform teleportable)
    {
        RaycastHit hit;

        if (Physics.Raycast(pointer.position, pointer.forward, out hit, Mathf.Infinity))
        {
            teleportable.position = new Vector3(hit.point.x, pointer.position.y, hit.point.z);
            SteamVR_Fade.Start(Color.black, 0);
            SteamVR_Fade.Start(Color.clear, 1);
        }
    }
    public void TeleportToLocation(Vector3 NewPosition)
    {
        //Store the position to use
        PositionToTeleportTo = NewPosition;

        //Fade the screen
        SteamVR_Fade.Start(Color.clear, 0);
        SteamVR_Fade.Start(Color.black, FadeDuration);

        Invoke("TeleportPlayer", FadeDuration);
    }
    // Use this for initialization
    void Start()
    {
        // prevent a cursor from rendering in the game & locks the cursor to ensure it stays inside the game window
        Cursor.lockState = CursorLockMode.Locked;

        rb       = GetComponent <Rigidbody> ();
        col      = GetComponent <CapsuleCollider> ();
        vrCamera = Camera.main;

        SteamVR_Fade.Start(Color.clear, 0f);
    }
Example #6
0
    private IEnumerator ExtinguishFire()
    {
        ActivateSprinkler();
        // Wait for 10 seconds
        yield return(new WaitForSeconds(10));

        DeactivateFlames();
        yield return(new WaitForSeconds(2));

        SteamVR_Fade.Start(Color.black, 5, false);
    }
 public void HeadsetOnChanged(bool isOn)
 {
     if (isOn)
     {
         SteamVR_Fade.Start(Color.clear, FadeDuration);
     }
     else
     {
         SteamVR_Fade.Start(BlackTransparent, FadeDuration);
     }
 }
Example #8
0
    IEnumerator Snap(float angle)
    {
        snapping = true;
        SteamVR_Fade.Start(Color.clear, 0);
        SteamVR_Fade.Start(Color.black, snapTime);
        yield return(new WaitForSeconds(snapTime));

        transform.RotateAround(vrCamera.position, Vector3.up, angle);
        SteamVR_Fade.Start(Color.clear, snapTime);
        snapping = false;
    }
Example #9
0
    void Teleport()
    {
        Vector3 eyePos = cameraEye.localPosition;

        eyePos.y           = 0;
        cameraRig.position = dot.transform.position - eyePos;

        dot.SetActive(false);

        SteamVR_Fade.Start(Color.clear, 0.3f);
        Invoke("Reset", 0.3f);
    }
Example #10
0
    private IEnumerator MoveRig(Transform cameraRig, Vector3 translation)
    {
        IsTelePorting = true;
        SteamVR_Fade.Start(Color.black, FadeTime, true);
        yield return(new WaitForSeconds(FadeTime));

        cameraRig.position += translation;

        SteamVR_Fade.Start(Color.clear, FadeTime, true);
        IsTelePorting = false;
        yield return(null);
    }
Example #11
0
    void FixedUpdate()
    {
        int min = boomTime_sec / 60;
        int sec = boomTime_sec % 60;

        if (boomTime_sec <= 0)
        {
            SteamVR_Fade.Start(Color.black, 5, true);
            print("TimeOver");
        }
        TimeCount.text = min + " : " + sec;
    }
        //-------------------------------------------------
        private void TeleportPlayer()
        {
            teleporting = false;

            Teleport.PlayerPre.Send(pointedAtTeleportMarker);

            SteamVR_Fade.Start(Color.clear, currentFadeTime);

            TeleportPoint teleportPoint    = teleportingToMarker as TeleportPoint;
            Vector3       teleportPosition = pointedAtPosition;

            if (teleportPoint != null)
            {
                teleportPosition = teleportPoint.transform.position;

                //Teleport to a new scene
                if (teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
                {
                    teleportPoint.TeleportToScene();
                    return;
                }
            }

            // Find the actual floor position below the navigation mesh
            TeleportArea teleportArea = teleportingToMarker as TeleportArea;

            if (teleportArea != null)
            {
                if (floorFixupMaximumTraceDistance > 0.0f)
                {
                    RaycastHit raycastHit;
                    if (Physics.Raycast(teleportPosition + 0.05f * Vector3.down, Vector3.down, out raycastHit, floorFixupMaximumTraceDistance, floorFixupTraceLayerMask))
                    {
                        teleportPosition = raycastHit.point;
                    }
                }
            }

            if (teleportingToMarker.ShouldMovePlayer())
            {
                Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                //player.trackingOriginTransform.position = teleportPosition + playerFeetOffset;
                //set where the player will be dashing towards
                dashDestination       = teleportPosition + playerFeetOffset;
                this.currentlyDashing = true;
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
Example #13
0
        //-------------------------------------------------
        private void TeleportPlayer()
        {
            teleporting = false;

            Teleport.PlayerPre.Send(pointedAtTeleportMarker);

            SteamVR_Fade.Start(Color.clear, currentFadeTime);

            TeleportPoint teleportPoint    = teleportingToMarker as TeleportPoint;
            Vector3       teleportPosition = pointedAtPosition;

            if (teleportPoint != null)
            {
                teleportPosition = teleportPoint.transform.position;

                //Teleport to a new scene
                if (teleportPoint.teleportType == TeleportPoint.TeleportPointType.SwitchToNewScene)
                {
                    teleportPoint.TeleportToScene();
                    return;
                }
            }

            // Find the actual floor position below the navigation mesh
            TeleportArea teleportArea = teleportingToMarker as TeleportArea;

            if (teleportArea != null)
            {
                if (floorFixupMaximumTraceDistance > 0.0f)
                {
                    RaycastHit raycastHit;
                    if (Physics.Raycast(teleportPosition + 0.05f * Vector3.down, Vector3.down, out raycastHit, floorFixupMaximumTraceDistance, floorFixupTraceLayerMask))
                    {
                        teleportPosition = raycastHit.point;
                    }
                }
            }

            if (teleportingToMarker.ShouldMovePlayer())
            {
                Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
                player.trackingOriginTransform.position = teleportPosition + playerFeetOffset;
            }
            else
            {
                teleportingToMarker.TeleportPlayer(pointedAtPosition);
            }

            //MJ20170525 Forcing disabling of highlight of future teleportPoint (necessary when never fully disabling teleport points, only mesh renderer)
            pointedAtTeleportMarker.Highlight(false);

            Teleport.Player.Send(pointedAtTeleportMarker);
        }
Example #14
0
    void EndTeleport()
    {
        // 自身の真下にレイを飛ばして足元を探る
        RaycastHit hitInfo;

        if (Physics.Raycast(transform.position, Vector3.down, out hitInfo, 100))
        {
            // ルームごと移動させるために、ターゲット座標とHMD座標との差分をCameraRigのポジションに適用
            CameraRig.transform.position = new Vector3(hitInfo.point.x - head.transform.pos.x, hitInfo.point.y, hitInfo.point.z - head.transform.pos.z);
            SteamVR_Fade.Start(Color.clear, 1.0f, false);
        }
    }
Example #15
0
    private IEnumerator ResetPlayer(Vector3 position)
    {
        SteamVR_Fade.Start(Color.black, FadeTime, true);

        // Apply translation
        yield return(new WaitForSeconds(FadeTime));

        Player.transform.position = position;

        // Fade to clear
        SteamVR_Fade.Start(Color.clear, FadeTime, true);
    }
Example #16
0
 private void Start()
 {
     sceneNow   = SCENE.SCENE_TITLE;
     sceneBefor = SCENE.SCENE_TITLE;
     fadeIn     = true;
     fade       = true;
     fadeSpeed  = 1.0f / fadeSecond / 60.0f;
     // 即座に画面を真っ白に
     SteamVR_Fade.Start(Color.black, 0f);
     // 2秒かけてクリアに戻す
     SteamVR_Fade.Start(Color.clear, 3f);
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     Debug.Log(image.material);
     this.tex = (MovieTexture)image.texture;
     EventManager.FireEvent(new PrologueStartEvent());
     tex.Play();
     StartCoroutine(FindEnd(() => {
         SteamVR_Fade.Start(Color.clear, 0);
         SteamVR_Fade.Start(Color.black, 1);
         EventManager.FireEvent(new PrologueDoneEvent());
     }));
 }
Example #18
0
        //-----------------------------------------------------
        private IEnumerator DoRotatePlayer(float angle)
        {
            Player player = Player.instance;

            canRotate = false;

            snapTurnSource.panStereo = angle / 90;
            snapTurnSource.PlayOneShot(rotateSound);

            if (fadeScreen)
            {
                SteamVR_Fade.Start(Color.clear, 0);

                Color tColor = screenFadeColor;
                tColor = tColor.linear * 0.6f;
                SteamVR_Fade.Start(tColor, fadeTime);
            }

            yield return(new WaitForSeconds(fadeTime));

            Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;

            player.trackingOriginTransform.position -= playerFeetOffset;
            player.transform.Rotate(Vector3.up, angle);
            playerFeetOffset = Quaternion.Euler(0.0f, angle, 0.0f) * playerFeetOffset;
            player.trackingOriginTransform.position += playerFeetOffset;

            GameObject fx = angle > 0 ? rotateRightFX : rotateLeftFX;

            if (showTurnAnimation)
            {
                ShowRotateFX(fx);
            }

            if (fadeScreen)
            {
                SteamVR_Fade.Start(Color.clear, fadeTime);
            }

            float startTime = Time.time;
            float endTime   = startTime + canTurnEverySeconds;

            while (Time.time <= endTime)
            {
                yield return(null);

                UpdateOrientation(fx);
            }
            ;

            fx.SetActive(false);
            canRotate = true;
        }
Example #19
0
    IEnumerator FadeIn()
    {
        time = 0;

        SteamVR_Fade.Start(Color.clear, FadeInTime);

        while (time < FadeInTime)
        {
            time += Time.deltaTime;
            yield return(null);
        }
    }
    private void RejoinBody()
    {
        if (!IsInvoking("RealRejoin"))
        {
            SteamVR_Fade.Start(Color.clear, 0);
            SteamVR_Fade.Start(Color.black, fadeTime);

            PlayAudioClip(headSource, teleportSound);

            Invoke("RealRejoin", fadeTime);
        }
    }
Example #21
0
    IEnumerator FadeOut()
    {
        time = 0;

        SteamVR_Fade.Start(Color.black, FadeOutTime);

        while (time < FadeOutTime)
        {
            time += Time.deltaTime;
            yield return(null);
        }
    }
Example #22
0
    public static float timeOflastSceneFadingCompletion  = -Mathf.Infinity; // tracking: the last time that a scene fading completed – initialized to negative infinity as a flag that scene fading has never completed



    // methods //


    // methods for: fading //

    // method: change the player's fadedness (blackness versus nonblackness, listening volume ratio) according the given progression ratio //
    public void changeFadedness(float progressionRatio)
    {
        if (fadeVisionToBlackness)              // only change the player's vision blackness if set to
        {
            SteamVR_Fade.Start(new Color(0f, 0f, 0f, progressionRatio), 0f);
        }

        if (fadeListeningVolume)              // only change the player's listening volume ratio if set to
        {
            AudioListener.volume = (1f - progressionRatio);
        }
    }
Example #23
0
    private void Awake()
    {
        //watchUI = GameObject.Find("Direction_Canvas");

        SteamVR_Fade.Start(Color.clear, 2f);

        //watchUI.SetActive(false);

        spawnPoint         = GameObject.Find("SpawnPoint").GetComponent <Transform>();
        thePlayer          = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        thePlayer.position = spawnPoint.position;
    }
Example #24
0
 void OnCollisionEnter(Collision collision)
 {
     Debug.Log("HEADSET COLLISION");
     if (collision.gameObject.tag == "Hands")
     {
         Debug.Log("COLLISION WITH HANDS");
     }
     else
     {
         SteamVR_Fade.Start(Color.black, 0f);
     }
 }
Example #25
0
    // Update is called once per frame
    void Update()
    {
        if (Physics.Raycast(tr.position, tr.forward, out hit, maxDistance))
        {
            // 라인의 끝점의 위치를 레이캐스팅한 지점의 좌표로 변경
            line.SetPosition(1, new Vector3(0, 0, hit.distance));

            line.enabled = true;

            if (teleport.GetStateDown(rightHand))
            {
                pointer.SetActive(true);
            }
            else if (teleport.GetState(rightHand))
            {
                line.material.color        = clickedColor;
                pointer.transform.position = hit.point + (hit.normal * 0.01f);
                pointer.transform.rotation = Quaternion.LookRotation(hit.normal);
            }
            else if (teleport.GetStateUp(rightHand))
            {
                line.material.color = color;
                pointer.SetActive(false);
                if (hit.transform.gameObject.layer == 8) //ground
                {
                    SteamVR_Fade.Start(Color.black, 0);
                    StartCoroutine(this.Teleport(hit.point));
                }
            }
            else if (hit.transform.CompareTag("Item"))
            {
                item = hit.transform.gameObject;
                if (trigger.GetState(rightHand)) // 오른손 트리거 - 직접 아이템을 끌어 옴
                {
                    line.material.color     = clickedColor;
                    item.transform.position = Vector3.Lerp(item.transform.position, transform.position, Time.deltaTime * 2);
                    dist = Vector3.Distance(item.transform.position, TriggerPoint.transform.position);
                    if (dist <= 1.5f)
                    {
                        item.transform.position = TriggerPoint.transform.position;
                        isTrigger = true;
                        item.GetComponent <Item>().IsGrabed = true;
                    }
                }
                line.material.color = color;
            }
        }
        if (isTrigger == true)
        {
            TriggerItem();
        }
    }
Example #26
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 #27
0
    // Update is called once per frame
    void Update()
    {
        if (prevButton != null)
        {
            OnPointerOut(prevButton);
            prevButton = null;
        }

        ray = new Ray(controller.position, controller.forward);

        if (Physics.Raycast(ray, out hit, maxDistance, layerButton))
        {
            line.SetPosition(1, new Vector3(0, 0, hit.distance));

            OnPointerIn(hit.collider.gameObject);
            prevButton = hit.collider.gameObject;

            if (trigger.GetStateDown(hand))
            {
                ExecuteEvents.Execute(hit.collider.gameObject,
                                      new PointerEventData(EventSystem.current), ExecuteEvents.pointerClickHandler);
            }
        }
        else
        {
            line.SetPosition(1, new Vector3(0, 0, maxDistance));
        }

        if (hand == SteamVR_Input_Sources.RightHand)
        {
            if (Physics.Raycast(ray, out hit, maxDistance, 1 << 10))
            {
                // 레이저 길이 조정
                line.SetPosition(1, new Vector3(0, 0, hit.distance));

                // 포인터의 위치 변경
                crossHair.transform.position = hit.point + (Vector3.up * 0.05f);
                crossHair.transform.rotation = Quaternion.LookRotation(hit.normal);
                crossHair.SetActive(true);

                if (teleport.GetStateUp(hand))
                {
                    SteamVR_Fade.Start(Color.black, 0.0f);
                    StartCoroutine(Teleport(hit.point));
                }
            }
            else
            {
                crossHair.SetActive(false);
            }
        }
    }
Example #28
0
    IEnumerator blackOutScreen()
    {
        // Tutorial.PlayWarning();
        //black out screen
        if (SceneManager.GetActiveScene().name == endScene)
        {
            while (!FadeToBlackAfterEnding)
            {
                yield return(null);
            }
            // yield return new WaitForSeconds(5);
            SteamVR_Fade.Start(Color.black, 5.0f);
            yield return(new WaitForSeconds(5.0f));

#if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
#else
            Application.Quit();
#endif
        }
        else
        {
            yield return(new WaitForSeconds(10));

            SteamVR_Fade.Start(Color.black, 7.0f);
            yield return(new WaitForSeconds(8.0f));

            //GetComponent<SteamVR_LoadLevel>().levelName = "Hexagon";
            //GetComponent<SteamVR_LoadLevel>().Trigger();
            // yield return new WaitForSeconds(7);
            Application.backgroundLoadingPriority = ThreadPriority.Low;
            AsyncOperation AO = SceneManager.LoadSceneAsync(endScene);
            AO.allowSceneActivation = false;

            //frisbee.transform.position = frisbeePlaceToMove;
            //cameraRig.transform.position = placeToMove;
            //SceneManager.LoadScene("Hexagon");
            //SteamVR_Fade.Start(Color.clear, 2.0f);

            while (AO.progress < 0.9f)
            {
                yield return(null);
            }
            AO.allowSceneActivation = true;
            destroyedObjects        = 0;
            won                      = false;
            disableGravity           = false;
            broadcastGravityDisabled = false;

            //SceneManager.UnloadSceneAsync(startScene);
        }
    }
Example #29
0
 // Token: 0x06005F91 RID: 24465 RVA: 0x00219BA8 File Offset: 0x00217FA8
 private void Awake()
 {
     if (this.text == null)
     {
         this.text         = base.GetComponent <GUIText>();
         this.text.enabled = false;
     }
     if (this.fadeDuration > 0f)
     {
         SteamVR_Fade.Start(this.fadeColor, 0f, false);
         SteamVR_Fade.Start(Color.clear, this.fadeDuration, false);
     }
 }
Example #30
0
    // Creates a fade out and fade in effect for the entire display
    IEnumerator ScreenFade()
    {
        SteamVR_Fade.Start(Color.black, 2f);

        yield return(new WaitForSeconds(4f));

        menu.gameObject.SetActive(true);
        int finalScore = numDefeated + (int)Mathf.Pow(timeAlive, 1.1f);

        menu.EndGame(GetNumDefeatedString(), GetTimeString(), finalScore);

        SteamVR_Fade.Start(Color.clear, 0.6f);
    }