diff --git a/Assets/Scripts/Tower/BeamTower.cs b/Assets/Scripts/Tower/BeamTower.cs index 7da6784..e6764ec 100644 --- a/Assets/Scripts/Tower/BeamTower.cs +++ b/Assets/Scripts/Tower/BeamTower.cs @@ -31,6 +31,12 @@ public class BeamTower : AimTower private IEnumerator AttackLoop() { do { + if (GameManager.Instance.CurrentNumEnemies == 0) + { + yield return new WaitForEndOfFrame(); + continue; + } + Vector3 origin = barrel.Tip.position; Vector3 rayDir = barrel.transform.forward; diff --git a/Assets/Scripts/Tower/GravityTower.cs b/Assets/Scripts/Tower/GravityTower.cs index 53a4dd1..4829710 100644 --- a/Assets/Scripts/Tower/GravityTower.cs +++ b/Assets/Scripts/Tower/GravityTower.cs @@ -35,6 +35,8 @@ public class GravityTower : Tower protected override void FixedUpdate() { + if (GameManager.Instance.CurrentNumEnemies == 0) return; + Collider[] projectilesInRadius = Physics.OverlapSphere(orb.position, radius, affectedBodies); foreach (var projectile in projectilesInRadius) { diff --git a/Assets/Scripts/Tower/ProjectileTower.cs b/Assets/Scripts/Tower/ProjectileTower.cs index 059e8e7..56050ee 100644 --- a/Assets/Scripts/Tower/ProjectileTower.cs +++ b/Assets/Scripts/Tower/ProjectileTower.cs @@ -31,6 +31,14 @@ public class ProjectileTower : AimTower private IEnumerator AttackLoop() { do { + Debug.Log($"{GameManager.Instance.CurrentNumEnemies == 0}"); + + if (GameManager.Instance.CurrentNumEnemies == 0) + { + yield return new WaitForEndOfFrame(); + continue; + } + yield return new WaitForSeconds(attackSecondsDelay); Debug.DrawRay(transform.position, horizontalArc.ToKnobVector, Color.red, attackSecondsDelay); Debug.DrawRay(transform.position, verticalArc.ToKnobVector, Color.green, attackSecondsDelay);