State machine rework

This commit is contained in:
Rendo 2025-12-09 22:34:17 +05:00
commit 87919ed890
25 changed files with 102 additions and 76 deletions

View file

@ -1,11 +1,11 @@
extends WeaponState
func enter() -> void:
func _enter() -> void:
machine.animation_player.play(machine.animation_prefix +"idle")
func exit() -> void:
func _exit() -> void:
pass
func use_begin() -> void:
func _use_begin() -> void:
if machine.ammo > 0:
transition.emit("Throw")

View file

@ -2,11 +2,11 @@ extends WeaponState
@export var emptyable: bool
func enter() -> void:
func _enter() -> void:
machine.animation_player.play(machine.animation_prefix + "intro")
machine.animation_player.animation_finished.connect(on_animation_finished)
func exit() -> void:
func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation):

View file

@ -2,11 +2,11 @@ extends WeaponState
const molik: PackedScene = preload("uid://b6qahd6q60js7")
func enter() -> void:
func _enter() -> void:
fire()
machine.animation_player.animation_finished.connect(on_animation_finished)
func exit() -> void:
func _exit() -> void:
machine.animation_player.animation_finished.disconnect(on_animation_finished)
func on_animation_finished(animation):