2024-05-13 22:38:17 -04:00
|
|
|
extends AnimationBase
|
2024-05-03 07:56:32 -04:00
|
|
|
|
2024-05-13 14:18:09 -04:00
|
|
|
@onready var texture: TextureRect = $TextureRect
|
|
|
|
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
|
|
|
|
|
|
|
|
var failIndex: int = 0
|
|
|
|
var animQueue: Queue = Queue.new()
|
2024-05-03 19:45:30 -04:00
|
|
|
|
2024-05-03 07:56:32 -04:00
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready():
|
2024-05-13 14:18:09 -04:00
|
|
|
if inverted:
|
2024-05-13 22:38:17 -04:00
|
|
|
attackName = inverseName
|
2024-05-03 19:45:30 -04:00
|
|
|
|
2024-05-09 22:21:58 -04:00
|
|
|
func castFailed() -> void:
|
2024-05-13 14:18:09 -04:00
|
|
|
queue_free()
|
|
|
|
|
|
|
|
func setProgress(target: float, final: float = finalProg) -> void:
|
|
|
|
targetProg = target
|
|
|
|
finalProg = final
|
2024-05-13 22:38:17 -04:00
|
|
|
if (index > -1):
|
|
|
|
animationPlayer.queue(attackName + str(index))
|
|
|
|
index += 1
|
2024-05-13 14:18:09 -04:00
|
|
|
|
2024-05-13 22:38:17 -04:00
|
|
|
func animFinished(s: String):
|
|
|
|
if (index == finalIndex):
|
|
|
|
animationFinished.emit(spell)
|
|
|
|
queue_free()
|