extends PlayerGroundState ## 蹲走(潜行):目标速度 = crouch_speed,播 sneak。 ## 蹲伏优先于疾跑:蹲着按 Shift 也只是潜行。 func _enter() -> void: var player := get_agent() as Player player.motor.target_speed = player.motor.crouch_speed player.motor.sprinting = false player.motor.crouching = true player.animation_player.play_state(PlayerAnimator.AnimState.SNEAK, player.motor.crouch_speed) func _think(_delta: float) -> void: var player := get_agent() as Player if not Input.is_action_pressed("crouch"): dispatch(&"crouch_end") elif not player.motor.has_move_input(): dispatch(&"move_stop")