2025-12-08 05:27:53 -05:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
using SLSUtilities.FunctionalAnimation;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame.FunctionalAnimation
|
|
|
|
|
|
{
|
2025-12-23 19:47:06 -05:00
|
|
|
|
[Serializable]
|
2025-12-08 05:27:53 -05:00
|
|
|
|
public class SetBreakthroughResistance : FuncAnimPayloadBase
|
|
|
|
|
|
{
|
|
|
|
|
|
[InfoBox("设置角色的突破抗性状态,同时开启或关闭轮廓线效果。\n角色会被突破类型相同或更高的攻击打断,不会被低于该突破类型的攻击打断。")]
|
|
|
|
|
|
|
|
|
|
|
|
[FormerlySerializedAs("outlineSwitch")]
|
|
|
|
|
|
[Tooltip("是否开启轮廓线")]
|
|
|
|
|
|
public bool isEnabling = true;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("是否从行为树参数获取突破类型")]
|
|
|
|
|
|
public bool getFromBehaviorTree = true;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("突破类型")]
|
|
|
|
|
|
[HideIf("getFromBehaviorTree")]
|
|
|
|
|
|
public BreakthroughType breakthroughableType = BreakthroughType.Heavy;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("是否使用详细设置")]
|
|
|
|
|
|
public bool detailedSettings = false;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("轮廓线宽度")]
|
|
|
|
|
|
[ShowIf("@this.detailedSettings && this.isEnabling")]
|
|
|
|
|
|
public float outlineWidth = 0.05f;
|
|
|
|
|
|
|
|
|
|
|
|
[Tooltip("轮廓线淡入淡出时间")]
|
|
|
|
|
|
[ShowIf("detailedSettings")]
|
|
|
|
|
|
public float outlineFadeDuration = 0.1f;
|
|
|
|
|
|
|
|
|
|
|
|
public override void Invoke()
|
|
|
|
|
|
{
|
|
|
|
|
|
var renderSc = character.renderSc;
|
|
|
|
|
|
|
|
|
|
|
|
if (getFromBehaviorTree)
|
|
|
|
|
|
{
|
|
|
|
|
|
string typeName = (character as Automata).behaviorTree.GetVariable<string>("BreakthroughableType").Value;
|
|
|
|
|
|
if (string.IsNullOrEmpty(typeName))
|
|
|
|
|
|
{
|
|
|
|
|
|
breakthroughableType = BreakthroughType.Heavy;
|
|
|
|
|
|
}
|
|
|
|
|
|
breakthroughableType = Enum.TryParse(typeName, out BreakthroughType parsedType) ? parsedType : BreakthroughType.Heavy;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isEnabling)
|
|
|
|
|
|
{
|
|
|
|
|
|
renderSc.OutlineOn(breakthroughableType, outlineWidth, outlineFadeDuration);
|
2026-02-13 09:22:11 -05:00
|
|
|
|
SetResistance(breakthroughableType, true);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
renderSc.OutlineOff(outlineFadeDuration);
|
2026-02-13 09:22:11 -05:00
|
|
|
|
SetResistance(breakthroughableType, false);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 09:22:11 -05:00
|
|
|
|
private void SetResistance(BreakthroughType type, bool isResistant)
|
2025-12-08 05:27:53 -05:00
|
|
|
|
{
|
|
|
|
|
|
foreach (var lowerType in Breakthrough.GetLowerTypes(type))
|
|
|
|
|
|
{
|
2026-02-13 09:22:11 -05:00
|
|
|
|
character.reactionSc.breakthroughResistances[lowerType].Modify(isResistant);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-13 09:22:11 -05:00
|
|
|
|
character.reactionSc.breakthroughResistances[type].Modify(!isResistant);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
|
|
|
|
|
|
foreach (var higherType in Breakthrough.GetHigherTypes(type))
|
|
|
|
|
|
{
|
2026-02-13 09:22:11 -05:00
|
|
|
|
character.reactionSc.breakthroughResistances[higherType].Modify(!isResistant);
|
2025-12-08 05:27:53 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|