Eonirr

Untitled

May 20th, 2025 (edited)
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. private void Update()
  2. {
  3. if(canShoot && currentWeapon && Input.GetMouseButton(0))
  4. {
  5. Shoot();
  6. }
  7. }
  8.  
  9. private void Shoot()
  10. {
  11. currentWeapon.Shooting();
  12. StartCoroutine(ResetShoot());
  13. }
  14.  
  15. private IEnumerator ResetShoot()
  16. {
  17. canShoot = false;
  18. yield return new WaitForSeconds(currentWeapon.weaponCooldown);
  19. canShoot = true;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment