update
This commit is contained in:
@@ -13,7 +13,6 @@ func _ready() -> void:
|
||||
spawn_position = global_position
|
||||
add_to_group("enemies")
|
||||
EventBus.entity_died.connect(_on_entity_died)
|
||||
EventBus.damage_dealt.connect(_on_damage_dealt)
|
||||
|
||||
func _on_entity_died(entity: Node) -> void:
|
||||
if entity == self:
|
||||
@@ -27,15 +26,14 @@ func _physics_process(delta: float) -> void:
|
||||
velocity.y -= gravity * delta
|
||||
move_and_slide()
|
||||
|
||||
func _on_damage_dealt(attacker: Node, damage_target: Node, _amount: float) -> void:
|
||||
if damage_target == self and attacker.name == "Player":
|
||||
_engage(attacker)
|
||||
|
||||
func _engage(new_target: Node3D) -> void:
|
||||
if state == State.CHASE or state == State.ATTACK:
|
||||
return
|
||||
target = new_target
|
||||
state = State.CHASE
|
||||
var aggro: Node = get_node_or_null("EnemyAggro")
|
||||
if aggro:
|
||||
aggro.add_aggro(new_target, 1.0)
|
||||
_alert_nearby()
|
||||
|
||||
func _alert_nearby() -> void:
|
||||
|
||||
Reference in New Issue
Block a user