21 lines
372 B
GDScript
21 lines
372 B
GDScript
class_name SkillsComponent
|
|
extends Node
|
|
|
|
@export var skills: Array[Skill]
|
|
|
|
func _ready():
|
|
var character := owner as Character
|
|
character.controller.used_skill.connect(use_skill)
|
|
|
|
func use_skill(slot: int):
|
|
if slot < 0 || slot >= skills.size():
|
|
return
|
|
|
|
var skill := skills[slot]
|
|
|
|
if !skill:
|
|
return
|
|
|
|
var scene := skill.scene.instantiate()
|
|
owner.add_child(scene)
|