Eonirr

Untitled

Apr 9th, 2025 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. if (Input.GetMouseButtonDown(0))
  2. {
  3. isCharging = true;
  4. currentForce = minForce;
  5. }
  6.  
  7. if (isCharging)
  8. {
  9. currentForce += chargeSpeed * Time.deltaTime;
  10. currentForce = Mathf.Clamp(_currentForce, minForce, maxForce);
  11. }
  12.  
  13. if (Input.GetMouseButtonUp(0))
  14. {
  15. isCharging = false;
  16. if (rb)
  17. {
  18. rb.velocity = transform.forward * currentForce;
  19. }
  20.  
  21. currentForce = 0f;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment