コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        // Jump?
        // If you want to jump in ladders, leave it here, otherwise move it down
        if (Input.GetButtonDown(PC2D.Input.JUMP))
        {
            _motor.Jump();
            _motor.DisableRestrictedArea();
        }

        _motor.jumpingHeld = Input.GetButton(PC2D.Input.JUMP);

        // X axis movement
        if (Mathf.Abs(Input.GetAxis(PC2D.Input.HORIZONTAL)) > PC2D.Globals.INPUT_THRESHOLD)
        {
            _motor.normalizedXMovement = Input.GetAxis(PC2D.Input.HORIZONTAL);
        }
        else
        {
            _motor.normalizedXMovement = 0;
        }

        if (Input.GetAxis(PC2D.Input.VERTICAL) != 0)
        {
            bool up_pressed = Input.GetAxis(PC2D.Input.VERTICAL) > 0;

            if (Input.GetAxis(PC2D.Input.VERTICAL) < -PC2D.Globals.FAST_FALL_THRESHOLD)
            {
                _motor.fallFast = false;
            }
        }

        if (Input.GetAxisRaw(PC2D.Input.VERTICAL) == -1)
        {
            _motor.Drop();
        }
        else if (Input.GetButtonDown(PC2D.Input.DASH))
        {
            _motor.Dash();
        }
        else if (Input.GetButtonDown(PC2D.Input.SLASH))
        {
            _motor.Slash();
        }
    }