Esempio n. 1
0
    void UpdateRolling()
    {
        if (mov2D.GetRollIntent() && mov2D.Grounded)
        {
            mov2D.SetRollIntent(false);
            mov2D.SetRolling(true);
            rollTimer = 0f;
        }

        if (mov2D.GetRolling())
        {
            if (rollTimer < ROLL_TIMER)
            {
                rollTimer             += Time.deltaTime;
                transform.eulerAngles += new Vector3(0f, 0f, -1090f * Time.deltaTime * Mathf.Sign(mov2D.GetVelocity().x));
            }
            else
            {
                rollTimer = 0f;
                mov2D.SetRolling(false);
                transform.eulerAngles = Vector3.zero;
            }
        }
    }