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.
61 lines
1.7 KiB
GDScript
61 lines
1.7 KiB
GDScript
extends Node3D
|
|
class_name Core
|
|
|
|
@onready var character = (get_owner() as Character)
|
|
@onready var status = (%Status as Status)
|
|
@onready var skill = (%Skill as Skill)
|
|
@onready var move = (%Move as Move)
|
|
@onready var combo = (%Combo as Combo)
|
|
|
|
var active_core_action_list = [
|
|
"free_attack_heavy","free_attack_light","free_jump","free_interact",
|
|
"lock_attack_heavy","lock_attack_light","lock_jump","lock_interact",
|
|
]
|
|
|
|
func _ready():
|
|
# test
|
|
for i in range(8):
|
|
status.core_active_list.append(null)
|
|
set_active_core(0,load("res://config/core/free01.tres"))
|
|
|
|
func _process(delta):
|
|
pass
|
|
|
|
func set_active_core(index:int,core:CoreCfg):
|
|
match core.type:
|
|
Enum.ECoreType.Free:pass
|
|
Enum.ECoreType.Lock:index+=4
|
|
Enum.ECoreType.Passive:return
|
|
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")
|
|
|
|
func on_add_active_core(index:int,core:CoreCfg):
|
|
for skill in core.skill_list:
|
|
var action = active_core_action_list[index]
|
|
combo.add_skill(action,skill)
|
|
|
|
func on_remove_active_core(index:int,core:CoreCfg):
|
|
for skill in core.skill_list:
|
|
var action = active_core_action_list[index]
|
|
combo.remove_skill(action,skill)
|
|
|
|
func add_passive_core(core:CoreCfg):
|
|
match core.type:
|
|
Enum.ECoreType.Free:return
|
|
Enum.ECoreType.Lock:return
|
|
status.core_passive_list.append(core)
|
|
status.emit_status("core_passive_list")
|
|
|
|
func remove_passive_core(core:CoreCfg):
|
|
match core.type:
|
|
Enum.ECoreType.Free:return
|
|
Enum.ECoreType.Lock:return
|
|
status.core_passive_list.filter(func(c):return c!=core)
|
|
status.emit_status("core_passive_list")
|