limbo hsm
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
extends PlayerGroundState
|
||||
## 原地蹲:目标速度 0,播 crouch(蹲着不动)。
|
||||
## 蹲着走是 Sneak —— 两者只差「有没有方向输入」,转换事件同为 move_start/stop。
|
||||
|
||||
func _enter() -> void:
|
||||
var player := get_agent() as Player
|
||||
player.motor.target_speed = 0.0
|
||||
player.motor.sprinting = false
|
||||
player.motor.crouching = true
|
||||
player.animation_player.play_state(PlayerAnimator.AnimState.CROUCH)
|
||||
|
||||
|
||||
func _think(_delta: float) -> void:
|
||||
var player := get_agent() as Player
|
||||
if not Input.is_action_pressed("crouch"):
|
||||
dispatch(&"crouch_end")
|
||||
elif player.motor.has_move_input():
|
||||
dispatch(&"move_start")
|
||||
Reference in New Issue
Block a user