Example #1
0
    IEnumerator StartFade()
    {
        steamVRFade.OnStartFade(Color.black, 0.5f, false);
        yield return(new WaitForSeconds(1f));

        steamVRFade.OnStartFade(Color.clear, 0.5f, false);
    }
Example #2
0
    private void Update()
    {
        if (state == TELEPORT_STATE.TRIGGERED)
        {
            stf.OnStartFade(Color.black, .7f, true);

            Fillimg.color = new Color(1f, 1f, 1f, 1f);
            //Debug.Log("Color full");
            Fillimg.fillAmount = acumTime;
            acumTime          += Time.smoothDeltaTime;

            if (Fillimg.fillAmount == 1f)
            {
                player.transform.position = new Vector3(target.position.x, player.transform.position.y, target.position.z);
                stf.OnStartFade(Color.clear, .7f, true);
                state    = TELEPORT_STATE.IDLE;
                acumTime = 0;
            }
        }

        if (state == TELEPORT_STATE.IDLE)
        {
            Fillimg.color = new Color(.5f, .5f, .5f, .5f);
            stf.OnStartFade(Color.clear, .001f, true);
        }
    }
    IEnumerator TeleportCoroutine(Matrix4x4 destinationMatrix)
    {
        if (cameraFader)
        {
            cameraFader.OnStartFade(teleportFadeColor, teleportFadeDuration, true);
            yield return(new WaitForSecondsRealtime(teleportFadeDuration));

            cameraFader.OnStartFade(teleportClearColor, teleportFadeDuration, true);
        }

        TennisSim.Utility.ApplyMatrixToTransformSpecific(transform, destinationMatrix, true, true, false);

        /*transform.rotation = Quaternion.Euler(0,
         *  Utility.VectorAngleOnPlane(transform.forward, playerCamera.forward, Vector3.up), 0)
         * transform.rotation;*/
        Vector3 delta = playerCamera.position - transform.position;

        delta.y             = 0;
        transform.position -= delta;
    }
Example #4
0
    private void StageLogo()
    {
        if (gameController.PlayerIsReady())
        {
            m_CanStart = true;
            textAnimation.animator.speed = 1;
            gameController.SetControllerHints(false);
        }
        if (!m_CanStart)
        {
            if (textAnimation.animator.GetCurrentAnimatorStateInfo(0).IsName("PassingText") &&
                textAnimation.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 0.5f)
            {
                textAnimation.animator.speed = 0;
            }

            gameController.SetControllerHints(true);
            return;
        }

        m_Timer += Time.deltaTime;
        if (m_Timer >= LOGO_WAIT_TIME && m_SecondTimer == 0)
        {
            // Activate fade animation
            fade.OnStartFade(Color.white, 3, true);
        }

        if (m_Timer >= LOGO_WAIT_TIME)
        {
            m_SecondTimer += Time.deltaTime;
        }
        if (m_SecondTimer >= LOGO_WAIT_TIME && m_ThirdTimer == 0)
        {
            // Change field weather
            weatherController.SetRandomWeather();

            // Activate logo sphere
            logoSphere.gameObject.SetActive(true);

            // Fade out
            fade.OnStartFade(Color.clear, 1, true);
        }

        if (m_SecondTimer >= LOGO_WAIT_TIME)
        {
            m_ThirdTimer += Time.deltaTime;
        }
        if (m_ThirdTimer >= LOGO_WAIT_TIME)
        {
            m_Timer       = 0;
            m_SecondTimer = 0;
            m_ThirdTimer  = 0;

            m_Action -= StageLogo;

            // Start idle stage
            gameController.stage = GameController.Stage.Idle;

            // Activate fade animation
            fade.OnStartFade(Color.white, 0, true);
            fade.OnStartFade(Color.clear, 2, true);

            // Deactivate logo sphere
            logoSphere.gameObject.SetActive(false);
        }
    }