Ejemplo n.º 1
0
        void AddAndInitializeStates()
        {
            CharacterState[] statesArray = CharacterActor.GetComponentsInChildren <CharacterState>();
            for (int i = 0; i < statesArray.Length; i++)
            {
                CharacterState state     = statesArray[i];
                string         stateName = state.GetType().Name;

                // The state is already included, ignore it!
                if (GetState(stateName) != null)
                {
                    Debug.Log("Warning: GameObject " + state.gameObject.name + " has the state " + stateName + " repeated in the hierarchy.");
                    continue;
                }

                states.Add(stateName, state);
                // state.Initialize();
            }
        }