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.
85 lines
2.9 KiB
GDScript
85 lines
2.9 KiB
GDScript
@tool
|
|
extends AnimationSelectCfg
|
|
class_name SkillCfg
|
|
|
|
@export var name: String
|
|
@export var skill_animation: Animation
|
|
@export var range: float
|
|
@export var free_lock: bool
|
|
@export var ignore_push: bool
|
|
@export var attack1: AttackCfg
|
|
@export var attack1_box: AttackBoxCfg
|
|
@export var attack2: AttackCfg
|
|
@export var attack2_box: AttackBoxCfg
|
|
@export var sub_character: CharacterCfg
|
|
@export var stance_from: Enum.EStance = Enum.EStance.GroundAny
|
|
@export var stance_to: Enum.EStance
|
|
@export var break_level: Enum.EBreakLevel = Enum.EBreakLevel.Break
|
|
@export var is_charging: bool
|
|
@export var mp_cost: int
|
|
@export var warn_type: Enum.ESkillWarnType = Enum.ESkillWarnType.None
|
|
|
|
@export var refresh_animation: bool:
|
|
get: return false
|
|
set(value): if Engine.is_editor_hint(): check_animation()
|
|
|
|
var attack_particle: Dictionary = {}
|
|
var owner: CharacterCfg
|
|
|
|
|
|
func check_animation() -> bool:
|
|
var res_name: String = get_res_name()
|
|
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 = get_res_name()
|
|
var path_index: String = "res://scene/effect/particle/%s_%d.tscn" % [res_name, index]
|
|
if ResourceLoader.exists(path_index):
|
|
attack_particle[index] = load(path_index)
|
|
else:
|
|
var path_default: String = "res://scene/effect/particle/%s.tscn" % res_name
|
|
if ResourceLoader.exists(path_default):
|
|
attack_particle[index] = load(path_default)
|
|
if index in attack_particle:
|
|
return attack_particle[index]
|
|
return null
|
|
|
|
|
|
func get_owner() -> CharacterCfg:
|
|
if not owner:
|
|
var owner_name: String = get_res_name().split("_")[0]
|
|
var path: String = "res://config/character/%s.tres" % owner_name
|
|
if ResourceLoader.exists(path):
|
|
owner = load(path) as CharacterCfg
|
|
return owner
|