FOVKick.FOVKickUp C# (CSharp) Метод

FOVKickUp() публичный Метод

public FOVKickUp ( ) : IEnumerator
Результат IEnumerator
    public IEnumerator FOVKickUp()
    {
        float t = Mathf.Abs((Camera.fieldOfView - originalFov) / FOVIncrease);

        while (t < 1f)
        {
            Camera.fieldOfView = originalFov + (IncreaseCurve.Evaluate(t) * FOVIncrease);
            Debug.Log(IncreaseCurve.Evaluate(t) * FOVIncrease);
            t += Time.deltaTime;
            yield return new WaitForEndOfFrame();
        }
    }

Usage Example

Пример #1
0
        private void GetInput(out float speed)
        {
            // Read input
            float horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
            float vertical   = CrossPlatformInputManager.GetAxis("Vertical");

            bool waswalking = m_IsWalking;

            // set the desired speed to be walking or running
            speed   = m_IsWalking ? m_WalkSpeed : m_RunSpeed;
            m_Input = new Vector2(horizontal, vertical);

            // normalize input if it exceeds 1 in combined length:
            if (m_Input.sqrMagnitude > 1)
            {
                m_Input.Normalize();
            }

            // handle speed change to give an fov kick
            // only if the player is going to a run, is running and the fovkick is to be used
            if (m_IsWalking != waswalking && m_UseFovKick && m_CharacterController.velocity.sqrMagnitude > 0)
            {
                StopAllCoroutines();
                StartCoroutine(!m_IsWalking ? m_FovKick.FOVKickUp() : m_FovKick.FOVKickDown());
            }
        }
All Usage Examples Of FOVKick::FOVKickUp