41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
namespace SHADE.Test
|
|
{
|
|
public class AnimTest : Script
|
|
{
|
|
#region Serialized Fields
|
|
[SerializeField]
|
|
private AnimationClipAsset idleClip;
|
|
[SerializeField]
|
|
private AnimationClipAsset runClip;
|
|
[SerializeField]
|
|
private AnimationClipAsset pickUpClip;
|
|
#endregion
|
|
|
|
#region Components
|
|
public Animator Animator { get; private set; }
|
|
#endregion
|
|
|
|
#region Lifecycle Functions
|
|
protected override void awake()
|
|
{
|
|
Animator = GetComponent<Animator>();
|
|
}
|
|
|
|
protected override void update()
|
|
{
|
|
if (Input.GetKeyUp(Input.KeyCode.Alpha1))
|
|
{
|
|
Animator.Play(idleClip);
|
|
}
|
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
|
|
{
|
|
Animator.Play(runClip);
|
|
}
|
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
|
|
{
|
|
Animator.Play(pickUpClip);
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |