コード例 #1
0
        /// <summary>
        /// 状态改变 进入新的状态时都会进入该状态的Enter()方法  是个重载的方法
        /// </summary>
        /// <param name="fsm"></param>
        /// <param name="last"></param>
        public void OnFSMStateChange(IEntityFSM fsm, float last)
        {
            if (this.FSM != null && this.FSM.StateChange(this, fsm))
            {
                return;
            }
            if (this.FSM == fsm && this.FSM != null && this.FSM.State == FsmStateEnum.DEAD)
            {
                return;
            }

            if (this.FSM != null)
            {
                this.FSM.Exit(this);
            }

            if (this.FSM != null)
            {
                this.RealEntity.mFSMStateName = fsm.ToString();
            }

            this.FSM     = fsm;
            StrategyTick = Time.time;
            this.FSM.Enter(this, last);
        }
コード例 #2
0
        /// <summary>
        ///状态改变
        /// </summary>
        /// <param name="fsm">要进入的状态</param>
        public void OnFSMStateChange(IEntityFSM fsm)
        {
            if (this.FSM != null && this.FSM.StateChange(this, fsm))
            {
                return;
            }
            if (this.FSM == fsm && this.FSM != null && (this.FSM.State == FsmStateEnum.DEAD))
            {
                return;
            }

            if (this.FSM != null)//想要进入新的状态,首先退出当前状态
            {
                this.FSM.Exit(this);
            }

            this.FSM = fsm;//状态转换
            if (this.FSM != null)
            {
                this.RealEntity.mFSMStateName = fsm.ToString();//获取当前状态的名称
            }
            StrategyTick = Time.time;
            this.FSM.Enter(this, 0.0f);//进入状态的Enter方法
        }
コード例 #3
0
 public bool StateChange(IEntity entity, IEntityFSM fsm)
 {
     return(CanNotStateChange);
 }