Ejemplo n.º 1
0
        internal bool AddTransition(Transition <S, T, G> transition, State <S, T, G> state)
        {
            if (StateTransitions.ContainsKey(transition))
            {
                return(false);
            }

            StateTransitions.Add(transition, state);
            return(true);
        }
Ejemplo n.º 2
0
        private void FindTransitions(SerializedObject _ownerObj, Dictionary <OTGCombatState, int> _stateRecord, int _currentLevel)
        {
            int amountOfTransitions = _ownerObj.FindProperty("m_stateTransitions").arraySize;

            for (int i = 0; i < amountOfTransitions; i++)
            {
                Object nextStateObj = _ownerObj.FindProperty("m_stateTransitions").GetArrayElementAtIndex(i).FindPropertyRelative("m_nextState").objectReferenceValue;
                if (nextStateObj != null)
                {
                    OTGCombatState state             = (OTGCombatState)nextStateObj;
                    bool           transitionRepeats = (_stateRecord.ContainsKey(state)) ? true : false;



                    StateNode           n      = new StateNode(state, _currentLevel + 1, _stateRecord, i);
                    StateNodeTransition nTrans = new StateNodeTransition(transitionRepeats, n);
                    if (!StateTransitions.ContainsKey(state))
                    {
                        StateTransitions.Add(state, nTrans);
                    }
                }
            }
        }