非標框架(8)-有限狀態機1-狀態機基類

using System;

namespace LaserWelder.StateMachine
{
    public abstract class StateBase : ICanExcuteMsg,ICloneable
    {
        public abstract void Update();
        public abstract StateType Type { get; }
        public abstract void Enter(StateType oldState);
        public abstract void Exit(StateType newState);
        public virtual void WorkEnd()
        {

        }
        public virtual void ExcuteMsg(string sender, string msg)
        {
            
        }

        public object Clone()
        {
           return this.MemberwiseClone();
        }
    }

    public interface ICanExcuteMsg
    {
        void ExcuteMsg(string sender, string msg);
    }
}
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章