using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public enum AnimationType { Idle, Walk, Attack, Dead } public class AgentAnimator : MonoBehaviour { [SerializeField] private Animator animator; public void SetAnimationTo(AnimationType animationType) { switch (animationType) { case AnimationType.Idle: PlayAnim("Idle"); break; case AnimationType.Walk: PlayAnim("walk"); break; case AnimationType.Attack: PlayAnim("Attack"); break; case AnimationType.Dead: PlayAnim("die"); break; default: Debug.Log("Animation is Missing or Argument is not valid"); break; } } private void PlayAnim(string anim) { animator.Play(anim); } }