Files
Bob.Song cf2e374998 修改
2026-03-10 16:03:38 +08:00

58 lines
1.2 KiB
C#

using System;
using RootMotion.FinalIK;
using UnityEngine;
namespace NBF
{
public class PlayerIK : PlayerMonoBehaviour
{
public enum UpdateType
{
Update = 0,
FixedUpdate = 1,
LateUpdate = 2,
Default = 3
}
public UpdateType UpdateSelected;
private LookAtIK _LookAtIK;
[SerializeField] private float transitionWeightTimeScale = 1f;
protected override void OnAwake()
{
_LookAtIK = GetComponent<LookAtIK>();
}
private void Update()
{
if (UpdateSelected == UpdateType.Update)
{
IKUpdateHandler();
}
}
private void FixedUpdate()
{
if (UpdateSelected == UpdateType.FixedUpdate)
{
IKUpdateHandler();
}
}
private void LateUpdate()
{
if (UpdateSelected == UpdateType.LateUpdate)
{
IKUpdateHandler();
}
}
private void IKUpdateHandler()
{
_LookAtIK.UpdateSolverExternal();
}
}
}