17 lines
482 B
GDScript3
17 lines
482 B
GDScript3
![]() |
class_name HudController extends Control
|
||
|
|
||
|
@onready var data: Data = $/root/Root/Data
|
||
|
@export var slots: Array[SpellSlot]
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
for i in range(data.spellbook.spells.size()):
|
||
|
if (data.spellbook.spells == null): break
|
||
|
slots[i].setSpell(data.spellbook.spells[i])
|
||
|
|
||
|
func spellCast(spell: Spell, cooldown: float):
|
||
|
for slot: SpellSlot in slots:
|
||
|
if slot.spell == spell:
|
||
|
slot.spellCast(cooldown)
|
||
|
return
|