2023-03-09 13:35:49 +08:00
|
|
|
|
namespace SHADE.Test
|
2023-03-09 15:14:30 +08:00
|
|
|
|
{
|
2023-03-09 13:35:49 +08:00
|
|
|
|
public class AnimTest : Script
|
|
|
|
|
{
|
|
|
|
|
#region Serialized Fields
|
|
|
|
|
[SerializeField]
|
2023-03-09 15:14:30 +08:00
|
|
|
|
private AnimationClipAsset fullClip;
|
|
|
|
|
[SerializeField]
|
2023-03-09 13:35:49 +08:00
|
|
|
|
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; }
|
2023-03-09 13:35:49 +08:00
|
|
|
|
#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))
|
2023-03-09 13:35:49 +08:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
}
|