Пример #1
0
    void LerpCrouch(float t)
    {
        crouchTimer += Time.deltaTime / t;
        crouchTimer  = Mathf.Clamp01(crouchTimer);
        cc.height    = Mathf.Lerp(standHeight, crouchHeight, crouchTimer);

        float sm = Mathf.Lerp(0, crouchSpeedMultiplier, crouchTimer); // Lerps crouch speed multiplier between none and the normal amount

        speedModifier.ApplyEffect("Crouching", sm, 0);                // Adds crouch speed multiplier to movement speed effects

        head.transform.localPosition = new Vector3(0, Mathf.Lerp(relativeHeadHeight * standHeight, relativeHeadHeight * crouchHeight, crouchTimer), 0);
    }