private void OnMouseUp() { if (helper == null) { return; } if (cachedGravity == null) { return; } helper.gameObject.SetActive(false); Vector3 d = cachedTransform.position - helper.position; Vector2 velocity = new Vector2(d.x, d.y); if (velocity.sqrMagnitude > 0.0f) { float k = Mathf.Clamp01(velocity.magnitude / maxDistance); cachedGravity.Launch(velocity.normalized * maxVelocity * k); } }