using System;
using UnityEngine;

namespace Stary.Evo
{
    public interface FSMIState {
        IFsmSystem FsmSystem { get; }
        string Name { get; }
        float Timer { get; set; }
        //进入该状态时调用
        void OnEnter();
        //每帧调用
        void OnUpdate();
        //退出该状态时调用
        void OnExit();
    }
    
    public abstract class AbstractFSMIState : FSMIState
    {
        public IFsmSystem FsmSystem { get; }
        public  string Name { get; }
        public abstract float Timer { get; set; }

        public AbstractFSMIState(IFsmSystem system)
        {
            FsmSystem = system;
            Name = GetType().Name;
        }

        public abstract void OnEnter();

        public virtual void OnUpdate()
        {
            Timer += Time.deltaTime;
        }

        public abstract void OnExit();
    }
}
