17 lines
722 B
GDScript
17 lines
722 B
GDScript
extends LimboHSM
|
|
## 玩家状态机根(挂在 Player/HSM 节点上,update_mode = MANUAL)。
|
|
##
|
|
## 只管最粗的一层:「身体在地上还是空中」。细分状态在两个子机里:
|
|
## Grounded 地面 grounded.gd —— Idle / Walk / Sprint / Crouch / Sneak
|
|
## Airborne 空中 airborne.gd —— Jump / Fall
|
|
## 推进由 Player._physics_process 显式调 update(delta)(管线第一位)。
|
|
|
|
@onready var grounded: LimboHSM = $Grounded
|
|
@onready var airborne: LimboHSM = $Airborne
|
|
|
|
|
|
func _setup() -> void:
|
|
# 起跳或踏空 → 空中;落地 → 回地面。事件的发起在各叶子状态里。
|
|
add_transition(grounded, airborne, &"airborne")
|
|
add_transition(airborne, grounded, &"landed")
|