Files
Cielonos/Assets/Scripts/MainGame/Base/FunctionalAnimation/Payloads/SwitchFuncAnim.cs
SoulliesOfficial 7ee2894a63 整合SLSUtilities
2026-01-17 11:35:49 -05:00

53 lines
1.8 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;
using Sirenix.OdinInspector;
using SLSUtilities.FunctionalAnimation;
using UnityEngine;
namespace Cielonos.MainGame.FunctionalAnimation
{
[Serializable]
public class SwitchFuncAnim : FuncAnimPayloadBase
{
public string animationName;
[Tooltip("是否启用高级设置")]
public bool advancedSettings;
[ShowIf("advancedSettings")]
[Tooltip("用于Update Event是否在落地时切换动画")]
public bool switchWhenLanding;
[ShowIf("advancedSettings")]
[Tooltip("如果switchWhenLanding为true是否覆盖地面检测的长度")]
public bool overrideGroundDetection;
[ShowIf("advancedSettings"), ShowIf("overrideGroundDetection")]
[Tooltip("覆盖地面检测的长度")]
public float overrideGroundDetectionLength = 0.1f;
public override void Invoke()
{
if (!advancedSettings)
{
character.animationSc.fullBodyFuncAnimSm.Play(animationName);
}
else
{
if (switchWhenLanding)
{
if (overrideGroundDetection)
{
if (character.movementSc.groundDetector.DetectGround())
{
character.animationSc.fullBodyFuncAnimSm.Play(animationName);
}
}
else
{
if (character.movementSc.groundDetector.DetectGround(overrideGroundDetectionLength))
{
character.animationSc.fullBodyFuncAnimSm.Play(animationName);
}
}
}
}
}
}
}