Files
Cielonos/Assets/Scripts/MainGame/Characters/Data/BlockData.cs

90 lines
3.2 KiB
C#
Raw Normal View History

2026-03-20 12:07:44 -04:00
using System.Collections.Generic;
using Sirenix.OdinInspector;
2026-05-10 11:47:55 -04:00
using SLSUtilities.WwiseAssistance;
2026-03-20 12:07:44 -04:00
using UnityEngine;
using UnityEngine.Serialization;
2026-05-23 08:27:50 -04:00
using Cielonos.MainGame.Inventory;
2026-03-20 12:07:44 -04:00
namespace Cielonos.MainGame.Characters
{
[CreateAssetMenu(fileName = "Block", menuName = "Cielonos/Characters/BlockData")]
public partial class BlockData : SerializedScriptableObject
{
2026-05-10 11:47:55 -04:00
[Title("General")]
2026-03-20 12:07:44 -04:00
[Tooltip("格挡名称")]
public string blockName;
[Tooltip("格挡优先级,数值越大,优先级越高")]
public int blockPriority;
[Tooltip("是否为限时格挡")]
public bool isLimitedTime = false;
[ShowIf("isLimitedTime")]
[Tooltip("默认格挡时间")]
public float defaultBlockTime = Mathf.Infinity;
2026-05-10 11:47:55 -04:00
[Tooltip("完美格挡窗口时间设为0表示没有完美格挡")]
2026-03-20 12:07:44 -04:00
public float perfectTime = 0.2f;
2026-05-10 11:47:55 -04:00
[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>();
2026-03-20 12:07:44 -04:00
2026-05-10 11:47:55 -04:00
[Title("Animation")]
2026-03-20 12:07:44 -04:00
[Tooltip("格挡动画")]
public List<string> weakHitFuncAnims;
public List<string> mediumHitFuncAnims;
public BlockSource CreateBlockSource(CharacterBase character, ItemBase sourceItem = null)
{
2026-05-10 11:47:55 -04:00
return new BlockSource(character, sourceItem, this);
2026-03-20 12:07:44 -04:00
}
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;
}
}
2026-05-23 08:27:50 -04:00
public partial class BlockData
2026-03-20 12:07:44 -04:00
{
[Title("Breakthrough")]
[LabelText("Advanced Settings")]
public bool advancedBreakthroughSettings;
2026-05-23 08:27:50 -04:00
[FormerlySerializedAs("overallBreakType")]
[Tooltip("等于和低于该突破类型的攻击都会被格挡")]
2026-03-20 12:07:44 -04:00
[EnumToggleButtons]
[HideIf("advancedBreakthroughSettings")]
2026-05-23 08:27:50 -04:00
public Breakthrough.Type overallBlockType = Breakthrough.Type.Heavy;
2026-03-20 12:07:44 -04:00
2026-05-23 08:27:50 -04:00
[FormerlySerializedAs("normalBlockBreakType")]
[Tooltip("普通格挡可抵御的最高突破类型,优先级高于整体设置")]
2026-03-20 12:07:44 -04:00
[EnumToggleButtons]
[ShowIf("advancedBreakthroughSettings")]
2026-05-23 08:27:50 -04:00
public Breakthrough.Type normalBlockType = Breakthrough.Type.Heavy;
2026-03-20 12:07:44 -04:00
2026-05-23 08:27:50 -04:00
[FormerlySerializedAs("perfectBlockBreakType")]
[Tooltip("完美格挡可抵御的最高的突破类型,优先级高于整体设置")]
2026-03-20 12:07:44 -04:00
[EnumToggleButtons]
[ShowIf("advancedBreakthroughSettings")]
2026-05-23 08:27:50 -04:00
public Breakthrough.Type perfectBlockType = Breakthrough.Type.Heavy;
2026-03-20 12:07:44 -04:00
}
}