limbo hsm
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
extends PlayerGroundState
|
||||
## 疾跑:目标速度 = sprint_speed,播 run。只在按着方向键时成立(Sprint 由 Walk 进入)。
|
||||
|
||||
func _enter() -> void:
|
||||
var player := get_agent() as Player
|
||||
player.motor.target_speed = player.motor.sprint_speed
|
||||
player.motor.sprinting = true
|
||||
player.motor.crouching = false
|
||||
player.animation_player.play_state(PlayerAnimator.AnimState.RUN, player.motor.sprint_speed)
|
||||
|
||||
|
||||
func _think(_delta: float) -> void:
|
||||
var player := get_agent() as Player
|
||||
if Input.is_action_pressed("crouch"):
|
||||
dispatch(&"crouch_start")
|
||||
elif not player.motor.has_move_input():
|
||||
dispatch(&"move_stop")
|
||||
elif not Input.is_action_pressed("sprint"):
|
||||
dispatch(&"sprint_stop")
|
||||
Reference in New Issue
Block a user