コード例 #1
0
        /// <summary>
        /// Adds a state to this state machine.  This function takes care of global states and ID checks.
        /// Should not really be used - instead use Character function 'CreateState' - it is much nicer and tidier.
        /// </summary>
        /// <param name="state"></param>
        public void CreateState(uint id, AnimationModule animation)
        {
            // This is a check to make sure that we are adding the states in the order they are declared in the enum.
            // If this doesn't occur, the states will be mixed up and all hell will break loose.
            Debug.Assert(id == currentAddedStates);

            State state = new State(id, animation);

            States[currentAddedStates] = state;
            currentAddedStates++;

            // If our state is global, add it to our list
            if (state.IsGlobal)
            {
                GlobalStates.Add(state);
            }
        }