예제 #1
0
        void BuildStateDict()
        {
            nameStateDict = new Dictionary <string, IState>();
            states        = GetComponents <State>();

            for (int i = 0; i < states.Length; i++)
            {
                IState state = states[i];
                nameStateDict[state.GetType().Name] = state;
                nameStateDict[StateMachineUtility.FormatState(state.GetType(), state.Layer.GetType())] = state;
            }
        }
예제 #2
0
        void BuildStateDict()
        {
            nameStateDict = new Dictionary <string, IState>();

            nameStateDict[EmptyState.Instance.GetType().Name] = EmptyState.Instance;

            foreach (State state in states)
            {
                if (state != null)
                {
                    nameStateDict[state.GetType().Name] = state;
                    nameStateDict[StateMachineUtility.FormatState(state.GetType(), state.layer.GetType())] = state;
                }
            }
        }
예제 #3
0
        void BuildStateDict()
        {
            nameStateDict = new Dictionary <string, IState>();
            states        = new IState[stateReferences.Length];

            nameStateDict[EmptyState.Instance.GetType().Name] = EmptyState.Instance;
            nameStateDict[StateMachineUtility.FormatState(EmptyState.Instance.GetType(), "")] = EmptyState.Instance;

            for (int i = 0; i < stateReferences.Length; i++)
            {
                IState state = (IState)stateReferences[i];

                if (state != null)
                {
                    nameStateDict[state.GetType().Name] = state;
                    nameStateDict[state is StateLayer ? state.GetType().Name : StateMachineUtility.FormatState(state.GetType(), state.Layer.GetType())] = state;
                    states[i] = state;
                }
            }
        }