Tired state added to test movement.
This commit is contained in:
parent
d5818f1c17
commit
2c7a8e64f2
|
|
@ -136,6 +136,13 @@ func _on_state_change(old_state_name:String, new_state :State):
|
|||
push_warning("Received non animated Actor state.")
|
||||
#current_state = new_state
|
||||
|
||||
func _on_modifiers_updated(_modifier_type :int, _modifier_action :int, _merged_modifier :StateModifier):
|
||||
## Get reference (subscribe) to the merged modifier for movement
|
||||
if _merged_modifier is StateModifierMovement:
|
||||
modifier = _merged_modifier
|
||||
|
||||
|
||||
|
||||
## Side effects for these variables
|
||||
# velocity - doesn't change but uses it to set base calculations
|
||||
# accepts the state to determine movement, the deltatime, and an optional direction
|
||||
|
|
|
|||
|
|
@ -68,6 +68,13 @@ func merge_modifiers():
|
|||
if m.is_active:
|
||||
#merged_animation_state_modifiers.merge(m)
|
||||
this_mod_type.merge(m)
|
||||
if m is StateModifierMovement:
|
||||
if merged_modifiers.has("StateModifierMovement") == false:
|
||||
merged_modifiers["StateModifierMovement"] = StateModifierMovement.new()
|
||||
#print(m.name)
|
||||
var this_mod_type :StateModifierMovement = merged_modifiers["StateModifierMovement"]
|
||||
if m.is_active:
|
||||
this_mod_type.merge(m)
|
||||
|
||||
# Change to the new state by first calling any exit logic on the current state.
|
||||
func change_state(new_state: State) -> void:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@ const state_to_item_map :Dictionary = {
|
|||
var player_info_index :int
|
||||
var player_data :PlayerData
|
||||
|
||||
## Temp Modifier to test movement modifier (getting tired)
|
||||
var tired_debuff_modifier = StateModifierMovement.new()
|
||||
# attack_sword = StateModifierAnimatedActor.new()
|
||||
# attack_sword.setup('sword_drawn',StateModifier.TYPE.ANIMATION_SUFFIX,2.0)
|
||||
# add_child(attack_sword.timeout)
|
||||
# #attack_sword.animation_name = 'PoopenStein'
|
||||
# attack_sword.animation_suffix = 'attack-sword'
|
||||
# add_state_modifier.call_func(attack_sword)
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
|
@ -59,6 +68,10 @@ func _ready():
|
|||
player_inventory.select_primary(punch_item)
|
||||
|
||||
movement_component.state_stamina_cost = state_stamina_cost
|
||||
|
||||
tired_debuff_modifier.setup('so_tired', StateModifier.TYPE.NONE)
|
||||
tired_debuff_modifier.horizontal_speed = -40
|
||||
movement_state_machine.push_state_modifier(tired_debuff_modifier)
|
||||
|
||||
#var stamina_recovery :float = 0.0
|
||||
|
||||
|
|
@ -86,7 +99,11 @@ func _process(delta):
|
|||
hitbox_component.damage_amount = state_damage_amount[movement_state_machine.current_state.name]
|
||||
else:
|
||||
hitbox_component.damage_amount = 10
|
||||
|
||||
|
||||
if stamina_component.stamina < 20 and tired_debuff_modifier.is_active == false:
|
||||
tired_debuff_modifier.activate()
|
||||
if stamina_component.stamina > 20 and tired_debuff_modifier.is_active == true:
|
||||
tired_debuff_modifier.deactivate()
|
||||
|
||||
|
||||
func hit_Receiver(damage):
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ max_health = 100
|
|||
[node name="Stamina_Component" parent="." index="9" instance=ExtResource( 29 )]
|
||||
unique_name_in_owner = true
|
||||
max_stamina = 50
|
||||
recovery_rate = 12
|
||||
recovery_rate = 2
|
||||
|
||||
[node name="Hurtbox_Component" parent="." index="10" instance=ExtResource( 16 )]
|
||||
collision_layer = 16
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user