Files
CultManor/game/characters/enemies/state_machine/walk_state.gd
T
2026-02-12 21:08:35 +03:00

24 lines
684 B
GDScript

@abstract
class_name CultistWalkState
extends CultistMoveState
@export var chase_state: CultistState
@export var another_direction_walk_state: CultistState
func physics_process(delta: float) -> void:
if not cultist.is_on_floor():
switch_state.emit(fall_state)
else:
var player := _get_colliding_player(_player_ray_cast)
if player != null:
switch_state.emit(chase_state)
else:
if _wall_ray_cast.is_colliding():
var stream := SoundManager.sfx_stream_player_lost
SoundManager.play_sfx_stream(stream, cultist.global_position)
switch_state.emit(another_direction_walk_state)
else:
cultist.update_x_velocity(_direction, cultist.MAX_WALK_SPEED, delta)