You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
GDScript
64 lines
1.8 KiB
GDScript
extends Node3D
|
|
class_name Core
|
|
|
|
@onready var character: Character = (get_owner() as Character)
|
|
@onready var status: Status = (%Status as Status)
|
|
@onready var skill: Skill = (%Skill as Skill)
|
|
@onready var move: Move = (%Move as Move)
|
|
|
|
var active_core_action_list: Array[String] = ["free_attack_heavy", "free_attack_light", "free_jump", "free_interact", "lock_attack_heavy", "lock_attack_light", "lock_jump", "lock_interact"]
|
|
|
|
|
|
func _ready():
|
|
for i in range(8):
|
|
status.core_active_list.append(null)
|
|
|
|
|
|
func _process(delta):
|
|
pass
|
|
|
|
|
|
func set_active_core(index: int, core: CoreCfg) -> void:
|
|
match core.type:
|
|
Enum.ECoreType.Passive: return
|
|
_: pass
|
|
if (index < 0) or (index >= 8):
|
|
return
|
|
var core_pre = status.core_active_list[index]
|
|
if core_pre:
|
|
on_remove_active_core(index, core_pre)
|
|
status.core_active_list[index] = core
|
|
on_add_active_core(index, core)
|
|
status.emit_status("core_active_list")
|
|
return
|
|
|
|
|
|
func on_add_active_core(index: int, core: CoreCfg):
|
|
var skill_cfg: SkillCfg = core.get_skill_cfg(0)
|
|
var action: String = active_core_action_list[index]
|
|
skill.add_skill(action, skill_cfg)
|
|
|
|
|
|
func on_remove_active_core(index: int, core: CoreCfg):
|
|
var skill_cfg: SkillCfg = core.get_skill_cfg(0)
|
|
var action: String = active_core_action_list[index]
|
|
skill.remove_skill(action, skill_cfg)
|
|
|
|
|
|
func add_passive_core(core: CoreCfg) -> void:
|
|
match core.type:
|
|
Enum.ECoreType.Active: return
|
|
_: pass
|
|
status.core_passive_list.append(core)
|
|
status.emit_status("core_passive_list")
|
|
return
|
|
|
|
|
|
func remove_passive_core(core: CoreCfg) -> void:
|
|
match core.type:
|
|
Enum.ECoreType.Active: return
|
|
_: pass
|
|
status.core_passive_list.filter(func(c): return c!=core)
|
|
status.emit_status("core_passive_list")
|
|
return
|