
- Finished up healing wave, wall of fire, and stone wall - Added system for spells playing sound effects - Fixed enemy spell randomization from getting duplicate entries
49 lines
1.1 KiB
GDScript
49 lines
1.1 KiB
GDScript
class_name AnimationBase extends Node2D
|
|
|
|
signal animationFinished(spell: Spell)
|
|
|
|
@onready var animationPlayer: AnimationPlayer = $AnimationPlayer
|
|
@onready var data: Data = $/root/Root/Data
|
|
|
|
@export var inverted: bool = false
|
|
@export var index: int = -1
|
|
@export var finalIndex: int = 0
|
|
@export var spell: Spell
|
|
@export var soundEffect: String
|
|
@export var soundPlayedIndex: int = -2
|
|
|
|
var attackName: String = "attackSegment"
|
|
var inverseName: String = "attackInverse"
|
|
var targetProg: float
|
|
var finalProg: float
|
|
var stream: AudioStream
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
stream = load(soundEffect)
|
|
if inverted:
|
|
attackName = inverseName
|
|
|
|
func _process(delta):
|
|
if (data.loc != data.Location.ARENA): self.free()
|
|
|
|
func castFailed() -> void:
|
|
die()
|
|
|
|
func setProgress(target: float, final: float = finalProg) -> void:
|
|
targetProg = target
|
|
finalProg = final
|
|
if (index > -1):
|
|
animationPlayer.queue(attackName + str(index))
|
|
if (index == soundPlayedIndex):
|
|
pass
|
|
index += 1
|
|
|
|
func animFinished(_s: String):
|
|
if (index == finalIndex):
|
|
animationFinished.emit(spell)
|
|
die()
|
|
|
|
func die():
|
|
queue_free()
|