Beispiel #1
0
    private IEnumerator transition_to_game()
    {
        m_cage.SetTrigger("Bust");
        m_hamster.SetTrigger("Bust");
        m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathPosition = 0.3f;
        m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_ZDamping     = 10.0f;

        m_cage.speed    = 1.0f;
        m_hamster.speed = 1.0f;

        m_shake_instance.Magnitude = m_shake_curve_mag.Evaluate(1.0f);
        m_shake_instance.Roughness = m_shake_curve_rough.Evaluate(1.0f);
        m_shake_instance.StartFadeOut(1.0f);

        float time_left = 3f;

        while (time_left > 0.0f)
        {
            if (time_left >= 2f)
            {
                Vector3 pos = m_shake_instance.UpdateShake();
                m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathOffset = pos;
            }
            else
            {
                m_camera_shake.GetCinemachineComponent <CinemachineTrackedDolly>().m_PathOffset = Vector3.zero;
            }

            yield return(null);

            time_left -= Time.deltaTime;
        }

        to_gameplay();
    }
Beispiel #2
0
    void Update()
    {
        posAddShake = new Vector3(0, 3.8f, -2f);
        //Vector3.zero;
        rotAddShake = new Vector3(15.4f, 0, 0);
        // Vector3.zero;

        for (int i = 0; i < cameraShakeInstances.Count; i++)
        {
            if (i >= cameraShakeInstances.Count)
            {
                break;
            }

            CameraShakeInstance c = cameraShakeInstances[i];

            if (c.CurrentState == CameraShakeState.Inactive && c.DeleteOnInactive)
            {
                cameraShakeInstances.RemoveAt(i);
                i--;
            }
            else if (c.CurrentState != CameraShakeState.Inactive)
            {
                posAddShake += CameraUtilities.MultiplyVectors(c.UpdateShake(), c.PositionInfluence);
                rotAddShake += CameraUtilities.MultiplyVectors(c.UpdateShake(), c.RotationInfluence);
            }
        }

        transform.localPosition    = posAddShake;
        transform.localEulerAngles = rotAddShake;
    }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        // Initialise the shake values
        posAddShake = Vector3.zero;
        rotAddShake = Vector3.zero;

        // Loop through shake instances
        for (int i = 0; i < cameraShakeInstances.Count; i++)
        {
            // Break from loop if exceeded instances count
            if (i >= cameraShakeInstances.Count)
            {
                break;
            }

            // Get the current camera shake instance
            CameraShakeInstance camShakeInstance = cameraShakeInstances[i];

            // If the current instance is inactive
            if (camShakeInstance.CurrentState == CAMERA_SHAKE_STATE.INACTIVE && camShakeInstance.deleteOnInactive)
            {
                // Remove from list from the list
                cameraShakeInstances.RemoveAt(i);
                i--;
            }

            // Else if current camera shake instance is not inactive
            else if (camShakeInstance.CurrentState != CAMERA_SHAKE_STATE.INACTIVE)
            {
                // Update camera position and rotation
                posAddShake += CameraUtilities.MultiplyVectors(camShakeInstance.UpdateShake(), camShakeInstance.positionInfluence);
                rotAddShake += CameraUtilities.MultiplyVectors(camShakeInstance.UpdateShake(), camShakeInstance.rotationInfluence);
            }
        }

        // Set camera position and rotation
        transform.localPosition    = posAddShake;
        transform.localEulerAngles = rotAddShake;
    }
    void Update()
    {
        //if (Input.GetKeyDown(KeyCode.E))
        //{
        //    Shake(CameraShakePresets.Bump);
        //}

        posAddShake = Vector3.zero;
        rotAddShake = Vector3.zero;

        for (int i = 0; i < cameraShakeInstances.Count; i++)
        {
            if (i >= cameraShakeInstances.Count)
            {
                break;
            }

            CameraShakeInstance c = cameraShakeInstances[i];

            if (c.CurrentState == CameraShakeState.Inactive && c.DeleteOnInactive)
            {
                cameraShakeInstances.RemoveAt(i);
                i--;
            }
            else if (c.CurrentState != CameraShakeState.Inactive)
            {
                posAddShake += CameraUtilities.MultiplyVectors(c.UpdateShake(), c.PositionInfluence);
                rotAddShake += CameraUtilities.MultiplyVectors(c.UpdateShake(), c.RotationInfluence);
            }
        }
        if (isUICamera)
        {
            posAddShake.z = UI_Z;
        }
        transform.localPosition    = posAddShake;
        transform.localEulerAngles = rotAddShake;
    }