|
|
|
|
@tool
|
|
|
|
|
extends AnimationSelectCfg
|
|
|
|
|
class_name SkillCfg
|
|
|
|
|
|
|
|
|
|
@export var name: String
|
|
|
|
|
@export var skill_animation: Animation
|
|
|
|
|
@export var free_lock: bool
|
|
|
|
|
@export var attack1: AttackCfg
|
|
|
|
|
@export var attack1_box: AttackBoxCfg
|
|
|
|
|
@export var attack2: AttackCfg
|
|
|
|
|
@export var attack2_box: AttackBoxCfg
|
|
|
|
|
|
|
|
|
|
@export var refresh_animation: bool:
|
|
|
|
|
get: return false
|
|
|
|
|
set(value): if Engine.is_editor_hint(): check_animation()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func check_animation() -> bool:
|
|
|
|
|
var res_name: String = Util.get_resource_name(self)
|
|
|
|
|
var path: String = "res://resource/skill_animation/%s.tres" % res_name
|
|
|
|
|
if sprite_frames == null:
|
|
|
|
|
print("未设置技能动画资源")
|
|
|
|
|
return false
|
|
|
|
|
if animation_name == "":
|
|
|
|
|
print("未设置技能动画名")
|
|
|
|
|
return false
|
|
|
|
|
if !sprite_frames.has_animation(animation_name):
|
|
|
|
|
print("技能动画名不存在")
|
|
|
|
|
return false
|
|
|
|
|
var animation: Animation = ResourceLoader.load(path) as Animation
|
|
|
|
|
if not animation:
|
|
|
|
|
animation = Animation.new()
|
|
|
|
|
animation.resource_name = res_name
|
|
|
|
|
Util.refresh_animation_by_sprite_frames(path, sprite_frames, animation_name, animation)
|
|
|
|
|
Util.refresh_animation_lib()
|
|
|
|
|
skill_animation = load(path)
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_attack1()->AttackCfg: return attack1 if attack1 else ResourceManager.cfg_attack_normal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_attack1_box()->AttackBoxCfg: return attack1_box if attack1_box else ResourceManager.cfg_attack_box_normal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_attack2()->AttackCfg: return attack2 if attack2 else ResourceManager.cfg_attack_normal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_attack2_box()->AttackBoxCfg: return attack2_box if attack2_box else ResourceManager.cfg_attack_box_normal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_attack_particle(index: int)->Resource:
|
|
|
|
|
var res_name: String = Util.get_resource_name(self)
|
|
|
|
|
var path_index: String = "res://scene/effect/particle/%s_%d.tscn" % [res_name, index]
|
|
|
|
|
if ResourceLoader.exists(path_index):
|
|
|
|
|
return load(path_index)
|
|
|
|
|
var path_default: String = "res://scene/effect/particle/%s.tscn" % res_name
|
|
|
|
|
if ResourceLoader.exists(path_default):
|
|
|
|
|
return load(path_default)
|
|
|
|
|
return null
|