SHADE_Y3/Assets/Scripts/AnimTest.cs

48 lines
1.2 KiB
C#
Raw Normal View History

namespace SHADE.Test
2023-03-09 15:14:30 +08:00
{
public class AnimTest : Script
{
#region Serialized Fields
[SerializeField]
2023-03-09 15:14:30 +08:00
private AnimationClipAsset fullClip;
[SerializeField]
private AnimationClipAsset idleClip;
[SerializeField]
private AnimationClipAsset runClip;
[SerializeField]
private AnimationClipAsset pickUpClip;
#endregion
#region Components
2023-03-09 15:14:30 +08:00
public Animator Animator { get; private set; }
#endregion
#region Lifecycle Functions
protected override void awake()
{
Animator = GetComponent<Animator>();
}
protected override void update()
{
2023-03-09 15:14:30 +08:00
if (Input.GetKeyUp(Input.KeyCode.Equals))
{
Animator.Play(fullClip);
}
else 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
}
2023-03-09 15:14:30 +08:00
}