Example #1
0
 private void InitDefaultState()
 {
     // 使用默认状态编号 为其他状态数据赋值
     defaultState   = states.Find(p => p.stateId == defaultStateID);
     currentState   = defaultState;
     currentStateID = defaultStateID;
 }
Example #2
0
        /// <summary> 配置状态机 </summary>
        private void ConfigFSM()
        {
            // 读取状态机配置
            var config = AIConfiguration.Load(aiConfigFile);

            foreach (var item in config)
            {
                // 反射创建状态对象
                FSMState state;
                string   path    = "AI.FSM." + item.Key + "State";
                Type     typeObj = Type.GetType(path);
                object   obj     = Activator.CreateInstance(typeObj);
                state = (FSMState)obj;

                foreach (var it in item.Value)
                {
                    // 添加条件映射
                    FSMTriggerID triggerIDenum = (FSMTriggerID)Enum.Parse(typeof(FSMTriggerID), it.Key, true);
                    FSMStateID   stateIDenum   = (FSMStateID)Enum.Parse(typeof(FSMStateID), it.Value, true);
                    state.AddTrigger(triggerIDenum, stateIDenum);
                }
                // 放入状态库中
                states.Add(state);
            }
        }
Example #3
0
        /// <summary>
        /// 增加映射对
        /// </summary>
        /// <param name="transitionID">转换条件ID</param>
        /// <param name="stateID">下一个转台ID</param>
        public void AddTransition(FSMTransitionID transitionID, FSMStateID stateID)
        {
            // 判空
            if (transitionID == FSMTransitionID.NullTransition)
            {
                Debug.LogError("FSMState ERROR: NullTransition is not allowed for a real transition");
                return;
            }

            if (stateID == FSMStateID.NullState)
            {
                Debug.LogError("FSMState ERROR: NullStateID is not allowed for a real ID");
                return;
            }

            // 已经存在
            if (map.ContainsKey(transitionID))
            {
                Debug.LogError("FSMState ERROR: State " + this.stateID.ToString() + " already has transition " + transitionID.ToString() +
                               "Impossible to assign to another state");
                return;
            }

            map.Add(transitionID, stateID);
            AddTransitionObject(transitionID);
        }
Example #4
0
    public void AddFSMState(FSMState fsmState)
    {
        if (fsmState == null)
        {
            Debug.LogError("state is null");
            return;
        }

        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            curState   = fsmState;
            curStateID = fsmState.ID;
            return;
        }

        foreach (var state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("state has exist");
                return;
            }
        }

        fsmStates.Add(fsmState);
    }
Example #5
0
        // -----------------------------------------------------------------------------------
        //
        // -----------------------------------------------------------------------------------
        public void AddTransition(FSMTransition trans, FSMStateID id)
        {
            // Check if anyone of the args is invalid
            if (trans == FSMTransition.NullTransition)
            {
                Debug.LogError("FSMState ERROR: NullTransition is not allowed for a real FSMTransition");
                return;
            }

            if (id == FSMStateID.NullStateID)
            {
                Debug.LogError("FSMState ERROR: NullStateID is not allowed for a real ID");
                return;
            }

            // Since this is a Deterministic FSM,
            //   check if the current FSMTransition was already inside the map
            if (map.ContainsKey(trans))
            {
                Debug.LogError("FSMState ERROR: State " + FSMStateID.ToString() + " already has FSMTransition " + trans.ToString() +
                               "Impossible to assign to another state");
                return;
            }

            map.Add(trans, id);
        }
Example #6
0
        // 新たに状態を追加をできます。
        public void AddFSMState(EnemyFSMState fsmState)
        {
            // 引数の確認
            if (fsmState == null)
            {
                Debug.LogError("FSM ERROR: Null reference is not allowed");
            }

            // 状態が存在しないときの条件式
            if (fsmStates.Count == 0)
            {
                fsmStates.Add(fsmState);
                currentState   = fsmState;
                currentStateID = fsmState.ID;
                return;
            }

            // 状態が存在する場合の条件式
            foreach (EnemyFSMState state in fsmStates)
            {
                if (state.ID == fsmState.ID)
                {
                    Debug.LogError("FSM ERROR: 既に存在する状態をリストに追加しようとしています。");
                    return;
                }
            }

            // 状態をリストに追加します
            fsmStates.Add(fsmState);
        }
Example #7
0
    /// <summary>
    /// Sets new state based off input transition
    /// </summary>
    /// <param name="trans">Transition to be set to given state</param>
    public void SetTransition(FSMTransitions trans)
    {
        if (trans == FSMTransitions.none)
        {
            Debug.LogError("Null transition is not allowed");
            return;
        }
        FSMStateID newID = currentState.CheckTransition(trans);

        if (newID == FSMStateID.none)
        {
            Debug.LogError("There is no state bound to " + trans.ToString());
            return;
        }
        foreach (var state in FSMStates)
        {
            if (newID == state.StateID)
            {
                Debug.Log("State changed to " + newID.ToString());
                currentState.OnStateExit(playerTransform, gameObject);

                currentState = state;
                currentState.OnStateEnter(playerTransform, gameObject);
                return;
            }
        }
        Debug.LogError("Unidentified error with state transition");
    }
Example #8
0
        public void Update()
        {
            currentStateID = currentState.StateID;

            currentState.Action(this);
            currentState.Reason(this);
        }
Example #9
0
 /// <summary>
 /// 添加当前状态的所对应的跳转条件的映射关系
 /// </summary>
 /// <param name="triggerID"></param>
 /// <param name="stateID"></param>
 public void AddMap(FSMTriggerID triggerID, FSMStateID stateID)
 {
     //将编号存入映射表
     map.Add(triggerID, stateID);
     //创建条件对象
     triggers.Add(CreatTriggerObject(triggerID));
 }
Example #10
0
    public void PerformTransition(Transition trans)
    {
        // Check for NullTransition before changing the current state
        if (trans == Transition.None)
        {
            Debug.LogError("FSM ERROR: Null transition is not allowed");
            return;
        }

        // Check if the currentState has the transition passed as argument
        FSMStateID id = currentState.GetOutputState(trans);

        if (id == FSMStateID.None)
        {
            Debug.LogError("FSM ERROR: Current State does not have a target state for this transition");
            return;
        }

        // Update the currentStateID and currentState
        currentStateID = id;
        foreach (FSMStates state in fsmStates)
        {
            if (state.ID == currentStateID)
            {
                currentState = state;
                break;
            }
        }
    }
Example #11
0
    public void AddFSMState(FSMStates fsmState)
    {
        // Check for Null reference before deleting
        if (fsmState == null)
        {
            Debug.LogError("FSM ERROR: Null reference is not allowed");
        }

        // First State inserted is also the Initial state
        //   the state the machine is in when the simulation begins
        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            currentState   = fsmState;
            currentStateID = fsmState.ID;
            return;
        }

        // Add the state to the List if it´s not inside it
        foreach (FSMStates state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("FSM ERROR: Trying to add a state that was already inside the list");
                return;
            }
        }

        //If no state in the current then add the state to the list
        fsmStates.Add(fsmState);
    }
Example #12
0
    public void PerformTransition(Transition trans)
    {
        if (trans == Transition.None)
        {
            Debug.LogError("FSM ERROR: Null transition is not allowed");
            return;
        }

        FSMStateID id = currentState.GetOutputState(trans);

        if (id == FSMStateID.None)
        {
            Debug.LogError("FSM ERROR: Current State does not have a target state for this transition");
            return;
        }

        currentStateID = id;
        foreach (FSMState state in fsmStates)
        {
            if (state.ID == currentStateID)
            {
                currentState = state;
                break;
            }
        }
    }
Example #13
0
 /// <summary>
 /// 由状态机调用
 /// </summary>
 /// <param name="triggerID"></param>
 /// <param name="stateID"></param>
 public void AddMap(FSMTriggerID triggerID, FSMStateID stateID)
 {
     //条件对应id
     map.Add(triggerID, stateID);
     //创建
     CreateTrigger(triggerID);
 }
Example #14
0
 public void ChangeActiveState(FSMStateID stateID)
 {
     //将currentState改变为当前状态ID的状态
     //?stateID   ->state   反射
     //在状态库当中寻找相应状态ID的状态对象
     if (stateID == currentStateID)
     {
         return;
     }
     itemState = stateList.Find(p => p.stateID == stateID);
     //没有的话  返回
     if (itemState == null)
     {
         return;
     }
     //执行当退出当前状态方法
     currentState.OnStateExit(this);
     if (stateID == defaultStateID)
     {
         currentState = defaultState;
     }
     //如果不是默认状态且当前状态库当中有该状态
     //切换当前状态和当前状态的ID
     currentState   = itemState;
     currentStateID = stateID;
     //执行当前状态的进入方法
     currentState.OnStateEnter(this);
 }
Example #15
0
    public void AddFSMState(FSMState fsmState)
    {
        if (fsmState == null)
        {
            Debug.LogError("FSM ERROR: Null reference is not allowed");
        }

        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            currentState   = fsmState;
            currentStateID = fsmState.ID;
            return;
        }

        foreach (FSMState state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("FSM ERROR: Trying to add a state that was already inside the list");
                return;
            }
        }

        fsmStates.Add(fsmState);
    }
Example #16
0
 //由状态机调用(为映射表和条件列表赋值)
 public void AddMap(FSMTriggerID triggerID, FSMStateID stateID)
 {
     //添加映射
     map.Add(triggerID, stateID);
     //创建条件对象
     CreateTriggerObject(triggerID);
 }
Example #17
0
    /// <summary>
    /// Add New State into the list
    /// </summary>
    public void AddFSMState(FSMState fsmState)
    {
        // Check for Null reference before deleting
        if (fsmState == null)
        {
            Debug.LogError("FSM ERROR: Null reference is not allowed");
        }

        // First State inserted is also the Initial state
        //   the state the machine is in when the simulation begins
        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            currentState = fsmState;
            currentStateID = fsmState.ID;
            return;
        }

        // Add the state to the List if it´s not inside it
        foreach (FSMState state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("FSM ERROR: Trying to add a state that was already inside the list");
                return;
            }
        }

        //If no state in the current then add the state to the list
        fsmStates.Add(fsmState);
    }
Example #18
0
        // このメソッドで遷移させます
        public void PerformTransition(Transition trans)
        {
            // 引数の確認
            if (trans == Transition.None)
            {
                Debug.LogError("FSM ERROR: Null遷移は不正です。");
                return;
            }

            // currentStateが指定の遷移についての状態を持つか
            FSMStateID id = currentState.GetOutputState(trans);

            if (id == FSMStateID.None)
            {
                Debug.LogError("FSM ERROR: 現在の状態はこの遷移が指定する状態を持ちません。");
                return;
            }

            // currentStateID と currentStateを更新
            currentStateID = id;
            foreach (EnemyFSMState state in fsmStates)
            {
                if (state.ID == currentStateID)
                {
                    currentState = state;
                    break;
                }
            }
        }
Example #19
0
 /// <summary>初始化起始状态</summary>
 private void InitDefaultState()
 {
     defaultState  = allState.Find(p => p.stateId == defaultStateId);
     currentState  = defaultState;
     currentSateId = currentState.stateId;
     currentState.EnterState(this);
 }
Example #20
0
    public void OnDisable()
    {
        //CancelInvoke("ResetTarget");
        //手动关闭状态机(自动挂机转为手机控制)
        if (currentStateId != FSMStateID.Dead)
        {
            currentState.ExitState(this);
            currentState = states.Find(p => p.stateId == FSMStateID.Idle);
            currentState.EnterState(this);
            currentStateId = currentState.stateId;
            PlayAnimation(anParam.Idle);
        }

        if (currentStateId == FSMStateID.Dead)
        {
            var sensors = GetComponents <AbstractSensor>();
            for (int i = 0; i < sensors.Length; i++)
            {
                sensors[i].enabled = false;
            }

            var triggers = GetComponents <AbstractTrigger>();
            for (int i = 0; i < triggers.Length; i++)
            {
                triggers[i].enabled = false;
            }
        }
    }
Example #21
0
 protected void AddTransition(Transition _transition, FSMStateID _fsmStateId)                   //对map进行添加
 {
     if (!map.ContainsKey(_transition))
     {
         map.Add(_transition, _fsmStateId);
     }
 }
Example #22
0
    public void AddFSMState(FSMState fsmState)
    {
        if (fsmState == null)
        {
            Debug.LogError("state is null");
            return;
        }

        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            curState = fsmState;
            curStateID = fsmState.ID;
            return;
        }

        foreach (var state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("state has exist");
                return;
            }
        }

        fsmStates.Add(fsmState);
    }
Example #23
0
		//新たに状態を追加
		public void AddFSMState(FSMState fsmState){
			//引数の確認
			if(fsmState == null){
				Debug.LogError("FSM ERROR: Null reference is not allowed");
			}

			//状態が存在しないときの条件式
			if(fsmStates.Count == 0)
			{
				fsmStates.Add(fsmState);
				currentState = fsmState;
				currentStateID = fsmState.ID;
				return;
			}
			
			//状態が存在する場合の条件式
			foreach(FSMState state in fsmStates)
			{
				if(state.ID == fsmState.ID)
				{
					Debug.LogError("FSM ERROR: 既に存在する状態をリストに追加しようとしています。");
					return;
				}
			}
			
			//状態をリストに追加する
			fsmStates.Add (fsmState);
		}
Example #24
0
    public void AddFSMState(PlayerFSMState fsmState)
    {
        if (fsmState == null)
        {
            Debug.LogError("FSM ERROR");
            return;
        }

        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            currentState   = fsmState;
            currentStateID = fsmState.ID;
            return;
        }

        foreach (PlayerFSMState state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("FSM ERROR:has already");
                return;
            }
        }

        fsmStates.Add(fsmState);
    }
Example #25
0
    // Adds a new state to the list
    public void AddFSMState(FSMState fsmState)
    {
        // Check for Null reference
        if (fsmState == null)
        {
            Debug.LogError("FSM ERROR: Null reference");
        }

        // First State inserted is also the
        if (fsmStates.Count == 0)
        {
            fsmStates.Add(fsmState);
            currentState   = fsmState;
            currentStateID = fsmState.ID;
            return;
        }

        // Add the state to the List
        foreach (FSMState state in fsmStates)
        {
            if (state.ID == fsmState.ID)
            {
                Debug.LogError("FSM Error: Trying to add a state");
                return;
            }
        }

        // If there is no state, add the current one to the list
        fsmStates.Add(fsmState);
    }
Example #26
0
File: FSM.cs Project: yazici/bounce
        public void PerformTransition(FSMTransistion trans)
        {
            // Check for NullTransition before changing the current state
            if (trans == FSMTransistion.None)
            {
                return;
            }

            // Check if the currentState has the transition passed as argument
            FSMStateID id = currentState.GetOutputState(trans);

            if (id == FSMStateID.None)
            {
                return;
            }


            // Update the currentStateID and currentState
            //currentStateID = id;
            foreach (FSMState state in fsmStates)
            {
                if (state.ID == id)
                {
                    // Store previous state and call exit method.
                    previousState = currentState;
                    previousState.Exit();

                    // Update current state and call enter method.
                    currentState = state;
                    currentState.Enter();

                    break;
                }
            }
        }
Example #27
0
        //状態の遷移メソッド
        public void PerformTransition(Transition tran)
        {
            //引数の確認
            if (tran == Transition.None)
            {
                Debug.LogError("FSMエラー: Null遷移は不正");
                return;
            }

            //CS(currenState)が指定の遷移についての状態を持つか
            FSMStateID id = CS.GetOutputState(tran);

            if (id == FSMStateID.None)
            {
                Debug.LogError("FSMエラー: 現在の状態は遷移が指定する状態を持たない");
                return;
            }

            //currentStateIDとcurrentStateを更新
            CSID = id;
            foreach (EnemyFSMState state in EFS)
            {
                if (state.ID == CSID)
                {
                    CS = state;
                    break;
                }
            }
        }
Example #28
0
        //状態の追加
        public void AddFSMState(EnemyFSMState fsmState)
        {
            //引数の確認
            if (fsmState == null)
            {
                Debug.LogError("FSMエラー:nullはあかんよ");
            }

            //状態がない場合の条件式
            if (EFS.Count == 0)
            {
                EFS.Add(fsmState);
                CS   = fsmState;
                CSID = fsmState.ID;
                return;
            }

            //状態がある場合の条件式
            foreach (EnemyFSMState state in EFS)
            {
                if (state.ID == fsmState.ID)
                {
                    Debug.LogError("FSM エラー:すでに存在する状態をリストに追加しようとしてます");
                    return;
                }
            }
            //状態をリストに追加
            EFS.Add(fsmState);
        }
Example #29
0
        /// <summary>状态切换</summary>
        public void ChangeActiveState(FSMTriggerID triggerId)
        {
            if (currentState == null)
            {
                return;
            }
            //根据条件编号,在当前状态查找输出状态
            var stateId = currentState.GetOutPutState(triggerId);

            //可能得到的3个结果
            //1.None : 不处理
            if (stateId == FSMStateID.None)
            {
                return;
            }
            //退出当前状态
            currentState.ExitState(this);
            //2.默认状态: 将原默认状态设为当前状态
            if (stateId == FSMStateID.Default)
            {
                currentState = defaultState;
            }
            else //3.具体状态: 将具体状态设为当前状态
            {
                currentState = allState.Find(p => p.stateId == stateId);
            }

            currentSateId = currentState.stateId;
            //进入新状态
            currentState.EnterState(this);
        }
Example #30
0
 public void AddTransition(Transition transition, FSMStateID id)
 {
     if (map.ContainsKey(transition))
     {
         return;
     }
     map.Add(transition, id);
 }
Example #31
0
    void OnStateEntered(FSMStateID stateID)
    {
        PrevStateID = stateID;

        CurStateID = stateID;

        FireOnStateChanged();
    }
Example #32
0
 public void AddTransition(Transition transition, FSMStateID id)
 {
     if (map.ContainsKey(transition))
     {
         return;
     }
     map.Add(transition, id);
 }
Example #33
0
        public ConsumptionShapesClearedReason(IStateTransitioner controller,
                                              IConsumerListener consumed, FSMStateID goToState)
            : base(FSMTransistion.AllConsumableShapesConsumed, goToState, controller)
        {
            m_Consumed = consumed;

            m_MarkCompleteJob = CM_Job.Make(MarkShouldTransition()).Repeatable();
        }
Example #34
0
 private void Update()
 {
     currentState.Reason(this);
     currentState.Action(this);
     FindTarget();
     //***********调试********
     currentStateID = currentState.StateID;
 }
Example #35
0
 public void DeleteState(FSMStateID id)
 {
     foreach (var state in fsmStates)
     {
         if (state.ID == id)
         {
             fsmStates.Remove(state);
             break;
         }
     }
 }
Example #36
0
 /// <summary>
 /// ���ֵ�����ÿ����һ��"ת��--״̬"��
 /// </summary>
 /// <param name="transition"></param>
 /// <param name="id"></param>
 public void AddTransition(Transition transition, FSMStateID id)
 {
     //������ת��(���Կ������ֵ�Ĺؼ���)�Ƿ����ֵ���
     if (map.ContainsKey(transition))
     {
         //һ��ת��ֻ�ܶ�Ӧһ����״̬
         Debug.LogWarning("FSMState ERROR: transition is already inside the map");
         return;
     }
     //��������ֵ䣬��ô�����ת����ת�����״̬��Ϊһ���µ��ֵ�������ֵ�
     map.Add(transition, id);
     Debug.Log("Added : " + transition + " with ID : " + id);
 }
Example #37
0
    /// <summary>
    /// This method delete a state from the FSM List if it exists, 
    ///   or prints an ERROR message if the state was not on the List.
    /// </summary>
    public void DeleteState(FSMStateID fsmState)
    {
        // Check for NullState before deleting
        if (fsmState == FSMStateID.None)
        {
            Debug.LogError("FSM ERROR: bull id is not allowed");
            return;
        }

        // Search the List and delete the state if it´s inside it
        foreach (FSMState state in fsmStates)
        {
            if (state.ID == fsmState)
            {
                fsmStates.Remove(state);
                return;
            }
        }
        Debug.LogError("FSM ERROR: The state passed was not on the list. Impossible to delete it");
    }
Example #38
0
    public void AddTransition(Transition transition, FSMStateID id)
    {
        // Check if anyone of the args is invallid
        if (transition == Transition.None || id == FSMStateID.None)
        {
            Debug.LogWarning("FSMState : Null transition not allowed");
            return;
        }

        //Since this is a Deterministc FSM,
        //Check if the current transition was already inside the map
        if (map.ContainsKey(transition))
        {
            Debug.LogWarning("FSMState ERROR: transition is already inside the map");
            return;
        }

        map.Add(transition, id);
        //Debug.Log("Added : " + transition + " with ID : " + id);
    }
Example #39
0
		//状態を削除する場合に使う
		public void DeleteState(FSMStateID fsmState)
		{
			//削除する前に、状態が空でないか確認
			if (fsmState == FSMStateID.None)
			{
				Debug.LogError("FSM ERROR: 不正なIDです。");
				return;
			}
			
			//状態を削除
			foreach(FSMState state in fsmStates)
			{
				if(state.ID == fsmState)
				{
					fsmStates.Remove(state);
					return;
				}
			}
			Debug.LogError ("FSM ERROR: 指定された状態が存在しません。削除に失敗しました。");
		}
Example #40
0
			public Dictionary<Transition, FSMStateID> AddTransition(Transition transition, FSMStateID id)
			{
				//引数の確認
				if(CheckTransOrID(transition, id))
				{
					Debug.LogWarning("FSMState: Null transition not allowed");
					throw new ConditionException();
					//return;
				}
				
				//現在の状態が、Map(Dictionary)に存在するかを確認。
				if(map.ContainsKey(transition))
				{
					Debug.LogWarning("FSMState ERROR: transition is already inside the map");
					//return;
				}
				
				map.Add (transition, id);
				Debug.Log ("Added : " + transition + "with ID : " + id);

				return map;
			}
Example #41
0
    /// <summary>
    /// This method tries to change the state the FSM is in based on
    /// the current state and the transition passed. If current state
    ///  doesn´t have a target state for the transition passed, 
    /// an ERROR message is printed.
    /// </summary>
    public void PerformTransition(Transition trans)
    {
        // Check for NullTransition before changing the current state
        if (trans == Transition.None)
        {
            Debug.LogError("FSM ERROR: Null transition is not allowed");
            return;
        }

        // Check if the currentState has the transition passed as argument
        FSMStateID id = currentState.GetOutputState(trans);
        if (id == FSMStateID.None)
        {
            Debug.LogError("FSM ERROR: Current State does not have a target state for this transition");
            return;
        }

        // Update the currentStateID and currentState		
        currentStateID = id;
        foreach (FSMState state in fsmStates)
        {
            if (state.ID == currentStateID)
            {
                currentState = state;
                break;
            }
        }
    }
Example #42
0
			//TansitionとIDのチェック
			public bool CheckTransOrID(Transition transition, FSMStateID id){
				if(EmptyTrans(transition) || EmptyID(id))
					return true;
				return false;
			}
Example #43
0
			public bool EmptyID(FSMStateID f){
				if (f == null) {
					throw new ConditionException ();
			}

				if(f == FSMStateID.None)
					return true;
				return false;
			}
Example #44
0
			public void SetStateID(FSMStateID fsmState){
				this.stateID = fsmState;
			}
Example #45
0
		//このメソッドで遷移させる
		public void RunTransition(Transition trans)
		{
			//引数の確認
			if(trans == Transition.None)
			{
				Debug.LogError("FSM ERROR: Null遷移は不正です。");
				return;
			}
			
			//currentStateが指定の遷移についての状態を持つか
			FSMStateID id = currentState.GetOutputState (trans);
			if(id == FSMStateID.None)
			{
				Debug.LogError("FSM ERROR: 現在の状態はこの遷移が指定する状態を持ちません。");
				return;
			}
			
			//currentStateIDとcurrentStateを更新
			currentStateID = id;
			foreach(FSMState state in fsmStates)
			{
				if(state.ID == currentStateID)
				{
					currentState = state;
					break;
				}
			}
		}
Example #46
0
    public void PerformTransition(Transition transition)
    {
        FSMStateID id = curState.GetOutputState(transition);
        curStateID = id;

        foreach (var state in fsmStates)
        {
            if (state.ID == curStateID)
            {
                curState = state;
                break;
            }
        }
    }