stamina tweak on old state.
This commit is contained in:
parent
5196b3eb6e
commit
1ceec696cc
|
|
@ -17,7 +17,9 @@ var state_stamina_cost :Dictionary
|
||||||
func _ready():
|
func _ready():
|
||||||
if debug_velocity_controller:
|
if debug_velocity_controller:
|
||||||
velocity_controller.debug = true
|
velocity_controller.debug = true
|
||||||
|
|
||||||
|
assert(parent is Actor, "Movement state receiver assumes parent is an Actor type.")
|
||||||
|
|
||||||
#var state_ref :State
|
#var state_ref :State
|
||||||
#var state_name :String
|
#var state_name :String
|
||||||
#state_name = 'jump'
|
#state_name = 'jump'
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,14 @@ func use_secondary_item() -> String:
|
||||||
func _on_Movement_StateMachine_state_changed(old_state_name, new_state):
|
func _on_Movement_StateMachine_state_changed(old_state_name, new_state):
|
||||||
## Reduce stamina if this state has a cost
|
## Reduce stamina if this state has a cost
|
||||||
if state_stamina_cost.has(new_state.name):
|
if state_stamina_cost.has(new_state.name):
|
||||||
stamina_component.reduce_stamina(state_stamina_cost[new_state.name])
|
## Skip stamina removal when coming from certain states
|
||||||
|
match old_state_name:
|
||||||
|
'climb':
|
||||||
|
pass
|
||||||
|
'ledge_grab':
|
||||||
|
pass
|
||||||
|
_:
|
||||||
|
stamina_component.reduce_stamina(state_stamina_cost[new_state.name])
|
||||||
|
|
||||||
|
|
||||||
func _on_Health_Component_health_depleted():
|
func _on_Health_Component_health_depleted():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user