예제 #1
0
    float lerpedWhammyVal(GamepadInput gamepad)
    {
        float rawVal = -1;

        if (gamepad.connected)
        {
            rawVal = gamepad.GetWhammyInput();
        }

        if (!canWhammy)
        {
            currentWhammyVal = -1;
        }
        else
        {
            if (rawVal > currentWhammyVal)
            {
                currentWhammyVal += whammyLerpSpeed * Time.deltaTime;
                if (currentWhammyVal > rawVal)
                {
                    currentWhammyVal = rawVal;
                }
            }
            else if (rawVal.Round(2) < currentWhammyVal)
            {
                currentWhammyVal -= whammyLerpSpeed * Time.deltaTime;
                if (currentWhammyVal < rawVal)
                {
                    currentWhammyVal = rawVal;
                }
            }
        }

        return(currentWhammyVal);
    }