Have Hiro AI use random melee animations

This commit is contained in:
Mario Martínez 2024-09-11 01:12:21 +02:00
parent 3016e63b23
commit 9e958d187a

View file

@ -132,6 +132,8 @@ func _on_animation_tree_animation_finished(anim_name):
state_machine.send_event("hurt_complete")
elif (anim_name.contains("kick") or anim_name.contains("punch")):
if wants_to_melee:
var animation_rng = randf_range(0, 1)
anim_tree.set("parameters/melee/blend_position", animation_rng)
anim_tree.set("parameters/conditions/melee", true)
else:
state_machine.send_event("melee_complete")
@ -183,8 +185,8 @@ func _on_meleebox_body_entered(body):
state_machine.send_event("will_melee")
func _on_melee_state_entered():
state_machine.set_expression_property("melee_stage", 0)
anim_tree.set("parameters/conditions/melee", true)
state_machine.set_expression_property("melee_stage", 0)
func _on_meleebox_body_exited(body):
if body == player_character: