21 lines
372 B
GDScript3
Raw Normal View History

2024-02-12 23:22:27 +00:00
class_name SkillsComponent
extends Node
2024-02-15 15:28:27 +00:00
@export var skills: Array[Skill]
2024-02-12 23:22:27 +00:00
func _ready():
2024-02-15 15:28:27 +00:00
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]
2024-02-12 23:22:27 +00:00
2024-02-13 22:12:32 +00:00
if !skill:
return
var scene := skill.scene.instantiate()
2024-02-15 15:28:27 +00:00
owner.add_child(scene)