MIF_E31222569/Assets/ToothyV/Scripts/Gameplay/AgentAnimator.cs

44 lines
964 B
C#

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);
}
}