Exemplo n.º 1
0
        /// <summary>
        /// Sets the state as not concurrent.
        /// Automatically handles undo.
        /// <param name="fsm">The fsm to remove the concurrent state.</param>
        /// </summary>
        public static void RemoveConcurrentState (InternalStateMachine fsm) {
            // The fsm is valid and the state is not the start state?
            if (fsm != null && fsm.concurrentState != null) {
                // Register undo
                #if UNITY_4_0_0 || UNITY_4_1 || UNITY_4_2
                Undo.RegisterUndo(fsm, "Concurrent State");
                #else
                Undo.RecordObject(fsm, "Concurrent State");
                #endif

                fsm.concurrentState = null;
                EditorUtility.SetDirty(fsm);

                // EditorUtility.SetDirty(state); // Repaint state inspector
            }
        }
Exemplo n.º 2
0
 public override void Reset () {
     stateMachine = null;
 }
Exemplo n.º 3
0
        /// <summary>  
        /// Returns the states in the supplied fsm hierarchy.  
        /// <prama name=f"fsm">The target fsm.</param>
        /// <prama name=f"exclude">Exclude the supplied StateMachine hierarchy.</param>
        /// <returns>All children in the fsm hierarchy.</returns>
        /// </summary>  
        InternalStateBehaviour[] GetStatesInHierarchy (InternalStateMachine fsm, InternalStateMachine exclude) {
            List<InternalStateBehaviour> states = new List<InternalStateBehaviour>();

            foreach (InternalStateBehaviour state in fsm.states) {
                if (!(state is InternalAnyState)) {
                    states.Add(state);

                    if (state != exclude) {
                        var fsmChild = state as InternalStateMachine;
                        if (fsmChild != null)
                            states.AddRange(GetStatesInHierarchy(fsmChild, exclude));
                    }
                }
            }

            return states.ToArray();
        }
 public override void Reset()
 {
     stateMachine = null;
 }