26 lines
426 B
C#
26 lines
426 B
C#
|
using UnityEngine;
|
||
|
|
||
|
[RequireComponent(typeof(Animator))]
|
||
|
[ExecuteInEditMode]
|
||
|
public class ForcePose : MonoBehaviour
|
||
|
{
|
||
|
[Tooltip("The animation clip to force.")]
|
||
|
public AnimationClip clip;
|
||
|
|
||
|
[Tooltip("The moment in the cycle to force.")]
|
||
|
[Range(0f, 1f)]
|
||
|
public float cycle;
|
||
|
|
||
|
private void Start()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
private void Update()
|
||
|
{
|
||
|
if ((bool)clip)
|
||
|
{
|
||
|
clip.SampleAnimation(base.gameObject, cycle * clip.length);
|
||
|
}
|
||
|
}
|
||
|
}
|