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.

42 lines
1.2 KiB
GDScript

@tool
extends AnimationSelectCfg
class_name SkillCfg
@export var name : String
@export var skill_animation : Animation
@export var attack_list : Array[AttackCfg]
@export var attack_particle : PackedScene
@export var free_lock : bool
@export var refresh_animation : bool :
get:return false
set(value):if Engine.is_editor_hint():check_animation()
func check_animation():
var res_name = Util.get_resource_name(self)
var skill_animation_path = "res://resource/skill_animation/%s.tres" %res_name
if !create_animation(res_name,skill_animation_path):
return
skill_animation = load(skill_animation_path)
func create_animation(res_name,path) -> bool:
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 = 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()
return true