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

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

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

            this.FSM     = fsm;
            StrategyTick = Time.time;
            this.FSM.Enter(this, last);
        }
Beispiel #2
0
    public void Aggro()
    {
        FSMState chaseState = FSMManager.GetState("ZombieChase");

        if (chaseState != null)
        {
            EntityFSM.ChangeState(chaseState);
        }
    }
Beispiel #3
0
    private void Start()
    {
        //FSM TESTING
        FSMState normalState = FSMManager.GetState("ZombieWander");

        if (normalState != null)
        {
            EntityFSM.ChangeState(normalState);
        }
        else
        {
            Debug.LogError("Can't find Zombie Wander state");
        }
    }
Beispiel #4
0
        /// <summary>
        ///状态改变
        /// </summary>
        /// <param name="fsm">要进入的状态</param>
        public void OnFSMStateChange(EntityFSM fsm)
        {
            if (this.FSM != null && this.FSM.StateChange(this, fsm))
            {
                return;
            }
            if (this.FSM == fsm && this.FSM != null && (this.FSM.State == FsmState.FSM_STATE_DEAD))
            {
                return;
            }

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

            this.FSM = fsm;//状态转换
            if (this.FSM != null)
            {
                this.RealEntity.FSMStateName = fsm.ToString();//获取当前状态的名称
            }
            StrategyTick = Time.time;
            this.FSM.Enter(this, 0.0f);//进入状态的Enter方法
        }
Beispiel #5
0
 public bool StateChange(Ientity entity, EntityFSM fsm)
 {
     return(CanNotStateChange);
 }