Skip to content

Commit 05a3e45

Browse files
committed
Guard script: Remove process state function
Unify it with _process
1 parent afebdec commit 05a3e45

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

  • scenes/game_elements/characters/enemies/guard/components

scenes/game_elements/characters/enemies/guard/components/guard.gd

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,6 @@ func _process(delta: float) -> void:
171171
if Engine.is_editor_hint() and not move_while_in_editor:
172172
return
173173

174-
_process_state()
175-
guard_movement.move()
176-
177-
if state != State.ALERTED:
178-
_update_player_awareness(delta)
179-
180-
_update_animation()
181-
182-
183-
## Updates the guard's movement behavior based on its current state.
184-
func _process_state() -> void:
185174
match state:
186175
State.PATROLLING:
187176
if patrol_path:
@@ -200,6 +189,13 @@ func _process_state() -> void:
200189
State.ALERTED:
201190
guard_movement.stop_moving()
202191

192+
guard_movement.move()
193+
194+
if state != State.ALERTED:
195+
_update_player_awareness(delta)
196+
197+
_update_animation()
198+
203199

204200
## Changes how PlayerAwareness looks to reflect how close is the player to
205201
## being detected

0 commit comments

Comments
 (0)