示例#1
0
    private void Jump(float force)
    {
        Vector2 velocity = rb.velocity;

        velocity.x = force / 3 * Mathf.Cos((float)angle * Mathf.Deg2Rad);
        float xForceFaultCoeficient = angle > 90f ? angle - 90f : 90f - angle;
        float yVelocity             = force - xForceFaultCoeficient / 30f;

        velocity.y = yVelocity > 1f ? yVelocity : 1f;
        if (yVelocity > 2)
        {
            jumper.AnimateJump();
        }
        else
        {
            jumper.AnimateStand();
        }
        rb.velocity = velocity;
    }