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

2 years ago
@tool
extends AnimationSelectCfg
class_name SkillCfg
@export var name : String
@export var skill_animation : Animation
2 years ago
@export var attack_list : Array[AttackCfg]
2 years ago
@export var attack_particle : PackedScene
@export var free_lock : bool
2 years ago
2 years ago
@export var refresh_animation : bool :
get:return false
set(value):if Engine.is_editor_hint():check_animation()
2 years ago
2 years ago
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
2 years ago
skill_animation = load(skill_animation_path)
2 years ago
func create_animation(res_name,path) -> bool:
if sprite_frames == null:
2 years ago
print("未设置技能动画资源")
return false
if animation_name == "":
print("未设置技能动画名")
return false
if !sprite_frames.has_animation(animation_name):
2 years ago
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()
2 years ago
return true