2024-05-03 07:56:32 -04:00
|
|
|
extends "res://Scripts/animationBase.gd"
|
|
|
|
|
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:
|
|
|
|
pass
|
|
|
|
#texture.position.x = (-(texture.position.x - 571)) + 571
|
|
|
|
#for point: Vector2 in path:
|
|
|
|
#point.x = (-(point.x - 571)) + 571
|
|
|
|
#for point: Vector2 in failPath:
|
|
|
|
#point.x = (-(point.x - 571)) + 571
|
|
|
|
#if !inverted:
|
|
|
|
#pass
|
|
|
|
#path = $Path2D/PathFollow2D
|
|
|
|
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
|
|
|
|
#else:
|
|
|
|
#pass
|
|
|
|
#path = $Path2D/PathFollow2D
|
|
|
|
#failPath = $Path2D/PathFollow2D/Path2D/PathFollow2D
|
2024-05-03 07:56:32 -04:00
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta):
|
2024-05-13 14:18:09 -04:00
|
|
|
pass
|
|
|
|
#if casting:
|
|
|
|
#if targetProg / finalProg < 0.7:
|
|
|
|
#timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.35))
|
|
|
|
#path.progress_ratio = timer
|
|
|
|
#else:
|
|
|
|
#timer = clampf(timer + delta, 0, 1)
|
|
|
|
#path.progress_ratio = timer
|
|
|
|
#if path.progress_ratio == 1:
|
|
|
|
#self.free()
|
|
|
|
#else:
|
|
|
|
#timer = clampf(timer + (1.25 * delta), 0, 1)
|
|
|
|
#failPath.progress_ratio = timer
|
|
|
|
#if failPath.progress_ratio == 1:
|
|
|
|
#self.free()
|
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()
|
|
|
|
#casting = false
|
|
|
|
#timer = 0
|
|
|
|
#texture.get_parent().remove_child(texture)
|
|
|
|
#failPath.add_child(texture)
|
|
|
|
|
|
|
|
func setProgress(target: float, final: float = finalProg) -> void:
|
|
|
|
targetProg = target
|
|
|
|
finalProg = final
|
|
|
|
animQueue.push("attackSegment" + str(target))
|
|
|
|
|
|
|
|
func animFinished(_animName):
|
|
|
|
if (animQueue.size() > 0):
|
|
|
|
animationPlayer.play(animQueue.pop())
|