only shoot in rounds

This commit is contained in:
Sveske Juice 2024-04-21 12:31:33 +02:00
parent 814d455eab
commit a57582fdc8
3 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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)
{

View File

@ -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);