57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
using Cielonos.MainGame.Characters;
|
|
using Lean.Pool;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
using UnityEngine.TextCore.Text;
|
|
|
|
namespace Cielonos.MainGame.Inventory
|
|
{
|
|
[CreateAssetMenu(fileName = "Block", menuName = "Cielonos/Items/BlockData")]
|
|
public class BlockData : SerializedScriptableObject
|
|
{
|
|
[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)
|
|
{
|
|
return new BlockSource(character, sourceItem, blockName, blockPriority,
|
|
"NormalBlock", "PerfectBlock", defaultBlockTime, perfectTime);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
} |