예제 #1
0
        public static bool DeleteMachineState(MachineState ms)
        {
            if (ms == null)
            {
                return(false);
            }
            StateTransition[]      transitions = StateTransitionDataControl.GetAllStateTransition();
            List <StateTransition> removeList  = new List <StateTransition>();

            for (int i = 0; i < transitions.Length; i++)
            {
                StateTransition st = transitions[i];
                if (st.fromState == ms || st.toState == ms)
                {
                    removeList.Add(st);
                }
            }

            for (int i = 0; i < removeList.Count; i++)
            {
                StateTransitionDataControl.DeleteStateTransition(removeList[i]);
            }
            allMachineState.Remove(ms.id);
            return(true);
        }
예제 #2
0
        public static void AddNewTransitionGUI(MachineState from, MachineState to)
        {
            StateTransition st = StateTransitionDataControl.AddNewStateTransition(from, to);

            StateTransitionArrowLineDataControl.AddStateTransitionToCreateArrowLine(st);
            if (StateMachineEditorWindow.OnAddStateTransition != null)
            {
                StateMachineEditorWindow.OnAddStateTransition(st);
            }
        }
 public static bool DeleteStateTransitionArrowLine(StateTransitionArrowLine line)
 {
     if (allStateTransitionArrowLineList.Contains(line))
     {
         foreach (var item in line.transitions)
         {
             StateTransitionDataControl.DeleteStateTransition(item);
         }
         allStateTransitionArrowLineList.Remove(line);
         Object.DestroyImmediate(line);
         return(true);
     }
     return(false);
 }
예제 #4
0
 public static void DeleteStateTransition(StateTransitionArrowLine line, StateTransition st)
 {
     if (line.transitions.Contains(st))
     {
         if (line.transitions.Count == 1)
         {
             StateTransitionArrowLineDataControl.DeleteStateTransitionArrowLine(line);
         }
         else
         {
             StateTransitionDataControl.DeleteStateTransition(st);
             line.transitions.Remove(st);
         }
         if (StateMachineEditorWindow.OnDeleteStateTransition != null)
         {
             StateMachineEditorWindow.OnDeleteStateTransition(st);
         }
     }
 }