Close #159: Remove aim logic in the Fire state

Now the Fire state doesn't depend on the Aim state anymore so I removed
the parenting
This commit is contained in:
Nathan Lovato 2019-09-07 10:04:25 +02:00
parent f54fb0eee2
commit 42bb4cbecd
2 changed files with 2 additions and 6 deletions

View file

@ -36,7 +36,7 @@ initial_state = NodePath("Aim")
[node name="Aim" type="Node" parent="StateMachine"]
script = ExtResource( 6 )
[node name="Fire" type="Node" parent="StateMachine/Aim"]
[node name="Fire" type="Node" parent="StateMachine"]
script = ExtResource( 7 )
[editable path="Arrow"]

View file

@ -5,10 +5,6 @@ func _on_Cooldown_timeout() -> void:
_state_machine.transition_to("Aim")
func physics_process(delta: float) -> void:
_parent.physics_process(delta)
func enter(msg: Dictionary = {}) -> void:
owner.cooldown.connect("timeout", self, "_on_Cooldown_timeout")
@ -17,7 +13,7 @@ func enter(msg: Dictionary = {}) -> void:
var target: HookTarget = owner.snap_detector.target
if not target:
var distance: = min(owner._radius, owner.get_local_mouse_position().length())
owner.arrow.hook_position = owner.global_position + owner.get_local_mouse_position().normalized() * distance
owner.arrow.hook_position = owner.global_position + owner.get_local_mouse_position().normalized() * distance / 2.0
_state_machine.transition_to("Aim")
return