25 lines
606 B
GDScript
25 lines
606 B
GDScript
extends Enemy
|
|
class_name Boss
|
|
|
|
|
|
@export var projectile : ProjectileResource
|
|
|
|
|
|
func _ready() -> void:
|
|
super._ready()
|
|
$TowerAttackRange.body_entered.connect(onAttackRangeBodyEntered)
|
|
$TowerAttackRange.body_exited.connect(onAttackRangeBodyExited)
|
|
|
|
|
|
func attack() -> bool:
|
|
# already attacked TheCube
|
|
if super.attack():
|
|
return true
|
|
|
|
var towerTargets : Array[Node3D] = targets.filter(func(b): return b is Tower)
|
|
if $AttackCooldown.is_stopped() && not towerTargets.is_empty():
|
|
projectile.shoot(towerTargets[0], global_position)
|
|
targets.erase(towerTargets[0])
|
|
$AttackCooldown.start()
|
|
|
|
return false
|