Files
BABA_YAGA/Assets/Scripts/Player/Generic/Animator/vChangeAnimatorUpdateMode.cs

41 lines
966 B
C#
Raw Normal View History

2026-05-30 09:16:35 +07:00
using Invector;
using UnityEngine;
public class vChangeAnimatorUpdateMode : MonoBehaviour
{
public Animator animator;
private readonly AnimatorUpdateMode initialState = AnimatorUpdateMode.Fixed;
public void Reset()
{
animator = GetComponentInParent<Animator>();
}
private void Start()
{
if (!animator) animator = GetComponentInParent<Animator>();
}
public void ChangeToUnscaledTime()
{
if (Time.timeScale == 0)
{
vTime.useUnscaledTime = true;
animator.updateMode = AnimatorUpdateMode.UnscaledTime;
}
}
public void ChangeToAnimatePhysics()
{
animator.updateMode = AnimatorUpdateMode.Fixed;
vTime.useUnscaledTime = false;
}
public void ChangeToInitialState()
{
animator.updateMode = initialState;
vTime.useUnscaledTime =initialState== AnimatorUpdateMode.UnscaledTime ?true:false;
}
}