Exemple #1
0
    public void Update()
    {
        if (checkingAxis)
        {
            float value = InputExtension.GetAxis(axisName);

            raise = value > previousValue ? true : false;
            Rotate(value, targetAngle);

            if (raise)
            {
                int div = (int)(value / 0.33f);
                if (div != brakePhase)
                {
                    brakePhase = div;

                    if (audioSource != null && handbrakeUp != null)
                    {
                        audioSource.clip = handbrakeUp;
                        audioSource.Play();
                    }
                }
            }
            else if (!raise && value < 0.33f && brakePhase != 0)
            {
                brakePhase = 0;
                if (audioSource != null && handbrakeDown != null)
                {
                    audioSource.clip = handbrakeDown;
                    if (!audioSource.isPlaying)
                    {
                        audioSource.Play();
                    }
                }
            }

            previousValue = value;
        }
    }
Exemple #2
0
    void PressPedal(string inputAxis, Rotator rotator)
    {
        float value = InputExtension.GetAxis(inputAxis);

        rotator.Rotate(value, rotator.targetAngle);
    }