private void AttackBehaviour() { if (shooter.GetTarget() == null) { if (targets.Count > 0) { shooter.SetTarget(targets[0]); } } if (shooter.GetTarget() != null) { if (shooter.GetTarget().GetComponent <Health>().IsDead()) { targets.Remove(shooter.GetTarget()); if (targets.Count != 0) { shooter.SetTarget(targets[0]); } } transform.GetComponentInChildren <TowerHead>().transform.LookAt(shooter.GetTarget()); if (shooter.CheckAttackTimer() && !shooter.GetTarget().GetComponent <Health>().IsDead()) { shooter.Shoot(); } shooter.UpdateAttackTimer(); } }
private void AttackBehaviour() { if (atLastWaypoint) { if (shooter.GetTarget() == null) { shooter.SetTarget(GameObject.FindWithTag("PlayerBase").transform); } if (enemyTurret != null) { enemyTurret.transform.LookAt(shooter.GetTarget()); } if (shooter.CheckAttackTimer() && !shooter.GetTarget().GetComponent <Health>().IsDead()) { shooter.Shoot(); } shooter.UpdateAttackTimer(); } }