using System.Collections; using System.Collections.Generic; using UnityEngine; using MyCollections.AI.FinitStateMachine; [RequireComponent(typeof(Animator))] public abstract class NPCConroller : MonoBehaviour { [SerializeField] protected FSM fsm; [SerializeField] protected Agent agent; protected Animator animator; public Agent Agent => agent; public Animator Animator => animator; protected virtual void Awake() { if (!TryGetComponent(out agent)) { Debug.LogError("Agent component not found on this GameObject!"); } animator = GetComponent<Animator>(); } // Start is called before the first frame update protected virtual void Start() { if (fsm != null) fsm.SetUp(this); } // Update is called once per frame protected virtual void Update() { if (fsm != null) fsm.GUpdate(); AnimationController(); } protected virtual void AnimationController() { } }