diff --git a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystemMobs.cs b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystemMobs.cs index 434e22a9782b6ce10bd81c80dfe365fcdcd0154c..36bc9724eafda38dd55d0446f952ed0bf76dbd8d 100644 --- a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystemMobs.cs +++ b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystemMobs.cs @@ -12,7 +12,7 @@ public class GunSystemMobs : MonoBehaviour public int magazineSize, bulletsPerTap, baseDamage, damage; int bulletsLeft, bulletsShot; - bool shooting, readyToShoot, reloading; + bool readyToShoot, reloading; // Refs public Transform attackPoint; @@ -90,7 +90,6 @@ public class GunSystemMobs : MonoBehaviour PlayOutOfAmmo(); Reload(); } else if (!reloading && readyToShoot) { - Vector3 direction = attackPoint.transform.forward; if (ShootingMultipleAtOnce) { @@ -118,15 +117,15 @@ public class GunSystemMobs : MonoBehaviour StartCoroutine(HideMuzzleFlash()); bulletsShot--; - if (bulletsShot == 0) + if (bulletsShot <= 0) { bulletsLeft--; PlayShootSound(); readyToShoot = false; bulletsShot = bulletsPerTap; + Invoke("ResetShot", timeBetweenShooting); } - Invoke("ResetShot", timeBetweenShooting); if (bulletsShot > 0 && bulletsLeft > 0) Invoke("Shoot", timeBetweenShots); @@ -149,4 +148,9 @@ public class GunSystemMobs : MonoBehaviour { readyToShoot = true; } + + public bool IsReloading() + { + return reloading; + } }