示例#1
0
    public override void OnUpdate()
    {
        if (Input.GetButtonDown("Jump"))
        {
            moveCtrl.ApplyForce(jump);
        }

        if (Input.GetButtonUp("Jump"))
        {
            //dampen vertical velocity
            Vector2 newVel = moveCtrl.GetVelocity();
            newVel.y = newVel.y * dampFactor;

            moveCtrl.SetVelocity(newVel);
        }
    }