Files
Cielonos/Assets/Scripts/MainGame/Characters/Data/BlockData.cs
2026-05-10 11:47:55 -04:00

88 lines
3.0 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 System.Collections.Generic;
using Sirenix.OdinInspector;
using SLSUtilities.WwiseAssistance;
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")]
[Tooltip("格挡名称")]
public string blockName;
[Tooltip("格挡优先级,数值越大,优先级越高")]
public int blockPriority;
[Tooltip("是否为限时格挡")]
public bool isLimitedTime = false;
[ShowIf("isLimitedTime")]
[Tooltip("默认格挡时间")]
public float defaultBlockTime = Mathf.Infinity;
[Tooltip("完美格挡窗口时间设为0表示没有完美格挡")]
public float perfectTime = 0.2f;
[Title("Audio")]
[WwiseEvent]
[Tooltip("完美格挡音效")]
public uint perfectBlockSound;
[WwiseEvent]
[Tooltip("普通格挡音效")]
public uint normalBlockSound;
[Title("VFX")]
public GameObject perfectBlockEffect;
public GameObject normalBlockEffect;
public Dictionary<string, GameObject> blockEffects = new Dictionary<string, GameObject>();
[Title("Animation")]
[Tooltip("格挡动画")]
public List<string> weakHitFuncAnims;
public List<string> mediumHitFuncAnims;
public BlockSource CreateBlockSource(CharacterBase character, ItemBase sourceItem = null)
{
return new BlockSource(character, sourceItem, this);
}
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;
}
}