Пример #1
0
    private void OnJump(IEvent jumpEvent)
    {
        JumpInputType inputType = ((JumpEvent)jumpEvent).jumpInputType;

        if (controller.collisions.below && ableToJump && inputType == JumpInputType.jumpDown)
        {
            ableToJump    = false;
            ableToAddJump = true;
            doJump        = true;
        }
        if (ableToAddJump && inputType == JumpInputType.jumpHold)
        {
            if (jumpAcc < charConfig.jumpTime)
            {
                jumpAcc += Time.deltaTime;
                doJump   = true;
            }
            else
            {
                jumpAcc       = 0f;
                ableToAddJump = false;
            }
        }
        if (!ableToJump && inputType == JumpInputType.jumpRelease)
        {
            ableToJump    = true;
            ableToAddJump = false;
        }
    }
Пример #2
0
 public JumpEvent(JumpInputType inputType)
 {
     jumpInputType = inputType;
 }