[CreateAssetMenu(fileName = "ComboData", menuName = "Scriptable Objects/ComboData")] public class ComboData : ScriptableObject { [SerializeField,Header("招式名称")]private string comboName; [SerializeField,Header("招式伤害")]private int comboDamage; [SerializeField,Header("被招式受击名称")]private string hitName; [SerializeField,Header("被招式格挡名称")]private string parryName;
public string ComboName => comboName; public int ComboDamage => comboDamage; public string HitName => hitName; public string ParryName => parryName; }
using NUnit.Framework; using System; using System.Collections.Generic; using UnityEngine;
[CreateAssetMenu(fileName = "Combo", menuName = "Scriptable Objects/Combo")] public class Combo : ScriptableObject { //存储招式 public List<ComboData> combo = new List<ComboData>();
//获得招式名字 public string TryGetComboName(int index) { if (combo.Count == 0 || combo.Count < index + 1) { return null; } else { return combo[index].ComboName; } }
//获得受伤动画名称 public string TryGetHitName(int index) { if (combo.Count == 0 || combo.Count < index + 1) { return null; } else { return combo[index].HitName; } }
//获得格挡动画名称 public string TryGetParryName(int index) { if (combo.Count == 0 || combo.Count < index + 1) { return null; } else { return combo[index].ParryName; } }
//获得招式伤害 public int TryGetComboDamage(int index) { if (combo.Count == 0 || combo.Count < index + 1) { return 0; } else { return combo[index].ComboDamage; } }
//获得招式动画数量 public int TryGetComboCount() => combo.Count; }