float lerpedWhammyVal()
    {
        float rawVal = GuitarInput.kNoWhammy;

        rawVal = GuitarInput.GetWhammyInput();

        if (!canWhammy)
        {
            currentWhammyVal = GuitarInput.kNoWhammy;
        }
        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);
    }
Example #2
0
    public void Update(float time, GuitarSustainHitKnowledge sustainKnowledge)
    {
        var currentSustains = sustainKnowledge.currentSustains;

        float whammyValue = GuitarInput.GetWhammyInput();

        foreach (var sustain in currentSustains)
        {
            foreach (Note note in sustain.note.chord)
            {
                NoteController nCon = note.controller;
                if (nCon != null)
                {
                    nCon.SetDesiredWhammy(whammyValue);
                }
            }
        }
    }