Files
zeling_v2/Assets/_Game/Scripts/Skills/FormSkillDatabaseSO.cs
2026-06-08 11:26:17 +08:00

47 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using UnityEngine;
using BaseGames.Player;
namespace BaseGames.Skills
{
/// <summary>
/// 形态技能数据库(<b>权威源</b>FormType → 该形态的 3 个技能1 魂技 + 2 魄技)。
/// <para>
/// <see cref="SkillManager"/>(执行)与 FormSkillPanel展示读<b>同一份</b>资产,消除数据重复。
/// 放在 Skills 程序集而非 FormSO因 BaseGames.Player 不能反向引用 BaseGames.Skills
/// Skills→Player 已有依赖,反向会循环),故技能引用不挂 FormSO见 DesignSpec §06 与 asmdef 约束)。
/// </para>
/// 资产Assets/_Game/Data/Skills/FormSkillDatabase.asset
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/Skills/Form Skill Database", fileName = "FormSkillDatabase")]
public class FormSkillDatabaseSO : ScriptableObject
{
[System.Serializable]
public struct Entry
{
[Tooltip("此条目对应的形态。")]
public FormType formType;
[Tooltip("形态标题的本地化 KeyUI 表,如 FORM_TIANHUN。供 FormSkillPanel 显示形态名。")]
public string formLabelKey;
[Tooltip("魂技(消耗灵力 / SoulPower。")]
public FormSkillSO soulSkill;
[Tooltip("魄技 1消耗魄元 / SpiritPower。")]
public FormSkillSO spiritSkill1;
[Tooltip("魄技 2。")]
public FormSkillSO spiritSkill2;
}
[SerializeField] private Entry[] _entries;
public Entry[] Entries => _entries;
/// <summary>取指定形态的技能条目;找不到返回 default三技能均 null。</summary>
public Entry GetByType(FormType type)
{
if (_entries != null)
foreach (var e in _entries)
if (e.formType == type) return e;
return default;
}
}
}