2026-05-10 11:47:55 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using Cielonos.MainGame.Characters;
|
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
using UnityEngine;
|
2026-05-23 08:27:50 -04:00
|
|
|
|
using UnityEngine.Serialization;
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame.FunctionalAnimation
|
|
|
|
|
|
{
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class SetRootMotionMultipliers : FuncAnimPayloadBase
|
|
|
|
|
|
{
|
|
|
|
|
|
[InfoBox("注意,此Payload参与对RootMotion的修改,和其它修改来源混用时需注意。")]
|
|
|
|
|
|
[Tooltip("是否设定倍数,如果不设定,则恢复为默认值1")]
|
|
|
|
|
|
public bool isSet;
|
2026-05-23 08:27:50 -04:00
|
|
|
|
|
|
|
|
|
|
[ShowIf("isSet")]
|
|
|
|
|
|
[Tooltip("是否从行为树参数获取突破类型")]
|
|
|
|
|
|
public bool getFromBehaviorTree;
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
|
[FormerlySerializedAs("getMultiplierFromVariableCollection")]
|
2026-05-10 11:47:55 -04:00
|
|
|
|
[ShowIf("isSet")]
|
|
|
|
|
|
[Tooltip("是否从VariableCollection里获取倍数")]
|
2026-05-23 08:27:50 -04:00
|
|
|
|
public bool getFromVariableCollection;
|
2026-05-10 11:47:55 -04:00
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
|
[HideIf("@isSet == false || getFromBehaviorTree == true || getFromVariableCollection == true")]
|
2026-05-10 11:47:55 -04:00
|
|
|
|
[Tooltip("自定义倍数")]
|
|
|
|
|
|
public Vector3 customMultiplier = Vector3.one;
|
|
|
|
|
|
|
|
|
|
|
|
public override void Invoke()
|
|
|
|
|
|
{
|
|
|
|
|
|
Vector3 multiplier = Vector3.one;
|
|
|
|
|
|
|
|
|
|
|
|
if (isSet)
|
|
|
|
|
|
{
|
2026-05-23 08:27:50 -04:00
|
|
|
|
if (getFromVariableCollection)
|
2026-05-10 11:47:55 -04:00
|
|
|
|
{
|
|
|
|
|
|
float mx = runtimeFuncAnim.runtimeVariables.GetVariable<float>("RootMotionMoveXMultiplier", 1);
|
|
|
|
|
|
float my = runtimeFuncAnim.runtimeVariables.GetVariable<float>("RootMotionMoveZMultiplier", 1);
|
|
|
|
|
|
float mz = runtimeFuncAnim.runtimeVariables.GetVariable<float>("RootMotionMoveYMultiplier", 1);
|
|
|
|
|
|
multiplier = new Vector3(mx, my, mz);
|
|
|
|
|
|
}
|
2026-05-23 08:27:50 -04:00
|
|
|
|
else if (getFromBehaviorTree)
|
|
|
|
|
|
{
|
|
|
|
|
|
BehaviorSubcontroller behaviorSc = (character as Automata)!.behaviorSc;
|
|
|
|
|
|
Vector3 btMultiplier = behaviorSc.mainBehaviorTree.GetVariable<Vector3>("RootMotionMultiplier").Value;
|
|
|
|
|
|
multiplier = btMultiplier;
|
|
|
|
|
|
}
|
2026-05-10 11:47:55 -04:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
multiplier = customMultiplier;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
|
character.movementSc.rootMotionMultiplier = multiplier;
|
2026-05-10 11:47:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|