18 lines
581 B
GDScript
18 lines
581 B
GDScript
extends PlayerGroundState
|
|
## 站立:目标速度 0,播 idle。
|
|
|
|
func _enter() -> void:
|
|
var player := get_agent() as Player
|
|
player.motor.target_speed = 0.0
|
|
player.motor.sprinting = false
|
|
player.motor.crouching = false
|
|
player.animation_player.play_state(PlayerAnimator.AnimState.IDLE)
|
|
|
|
|
|
func _think(_delta: float) -> void:
|
|
# 蹲键优先 —— 同帧又蹲又走时先蹲下,下一帧 Crouch 再转 Sneak,不会漏蹲。
|
|
if Input.is_action_pressed("crouch"):
|
|
dispatch(&"crouch_start")
|
|
elif (get_agent() as Player).motor.has_move_input():
|
|
dispatch(&"move_start")
|