91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.Serialization;
|
|
|
|
namespace Cielonos.MainGame.Characters
|
|
{
|
|
using Inventory;
|
|
|
|
[CreateAssetMenu(fileName = "Block", menuName = "Cielonos/Characters/BlockData")]
|
|
public partial class BlockData : SerializedScriptableObject
|
|
{
|
|
[Title("General Settings")]
|
|
[Tooltip("格挡名称")]
|
|
public string blockName;
|
|
|
|
[Tooltip("格挡优先级,数值越大,优先级越高")]
|
|
public int blockPriority;
|
|
|
|
[Tooltip("是否为限时格挡")]
|
|
public bool isLimitedTime = false;
|
|
|
|
[ShowIf("isLimitedTime")]
|
|
[Tooltip("默认格挡时间")]
|
|
public float defaultBlockTime = Mathf.Infinity;
|
|
|
|
[Tooltip("完美格挡窗口时间")]
|
|
public float perfectTime = 0.2f;
|
|
|
|
|
|
[Tooltip("格挡特效")]
|
|
public Dictionary<string, GameObject> blockEffects = new Dictionary<string, GameObject>()
|
|
{
|
|
{"NormalBlock", null},
|
|
{"PerfectBlock", null}
|
|
};
|
|
|
|
[Tooltip("格挡动画")]
|
|
public List<string> weakHitFuncAnims;
|
|
public List<string> mediumHitFuncAnims;
|
|
|
|
public BlockSource CreateBlockSource(CharacterBase character, ItemBase sourceItem = null)
|
|
{
|
|
if (advancedBreakthroughSettings)
|
|
{
|
|
return new BlockSource(character, sourceItem, blockName, blockPriority, defaultBlockTime, perfectTime,
|
|
normalBlockBreakType, "NormalBlock",
|
|
perfectBlockBreakType, "PerfectBlock");
|
|
}
|
|
else
|
|
{
|
|
return new BlockSource(character, sourceItem, blockName, blockPriority, defaultBlockTime, perfectTime,
|
|
overallBreakType, "NormalBlock",
|
|
overallBreakType, "PerfectBlock");
|
|
}
|
|
}
|
|
|
|
public GameObject InstantiateBlockEffect(string effectName, CharacterBase creator, Vector3 position, Quaternion rotation)
|
|
{
|
|
if (blockEffects.TryGetValue(effectName, out GameObject effect))
|
|
{
|
|
GameObject obj = VFXObject.Spawn(effect, creator, position, rotation);
|
|
return obj;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public partial class BlockData : SerializedScriptableObject
|
|
{
|
|
[Title("Breakthrough")]
|
|
[LabelText("Advanced Settings")]
|
|
public bool advancedBreakthroughSettings;
|
|
|
|
[Tooltip("等于和高于此突破类型的攻击将打断格挡")]
|
|
[EnumToggleButtons]
|
|
[HideIf("advancedBreakthroughSettings")]
|
|
public BreakthroughType overallBreakType = BreakthroughType.Disruption;
|
|
|
|
[Tooltip("普通格挡被打断的突破类型,优先级高于整体设置")]
|
|
[EnumToggleButtons]
|
|
[ShowIf("advancedBreakthroughSettings")]
|
|
public BreakthroughType normalBlockBreakType = BreakthroughType.Heavy;
|
|
|
|
[Tooltip("完美格挡被打断的突破类型,优先级高于整体设置")]
|
|
[EnumToggleButtons]
|
|
[ShowIf("advancedBreakthroughSettings")]
|
|
public BreakthroughType perfectBlockBreakType = BreakthroughType.Disruption;
|
|
}
|
|
} |