using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Assertions; public class ProjectileTower : AimTower { [SerializeField, Range(0.01f, 20f)] private float attackSecondsDelay = 1f; [SerializeField] private ProjectilePattern[] projectileSequence; private ProjectileSpawner projectileSpawner; protected override void Awake() { base.Awake(); projectileSpawner = GetComponent(); Assert.IsNotNull(projectileSpawner); StartCoroutine(AttackLoop()); } private IEnumerator AttackLoop() { do { yield return new WaitForSeconds(attackSecondsDelay); Debug.DrawRay(transform.position, horizontalArc.ToKnobVector, Color.red, attackSecondsDelay); Debug.DrawRay(transform.position, verticalArc.ToKnobVector, Color.green, attackSecondsDelay); Debug.DrawRay(transform.position, AimDirection, Color.yellow, attackSecondsDelay); projectileSpawner.RunBulletSequence(barrel.Tip.position, transform.up, AimDirection, projectileSequence); } while (true); } }