Ejemplo n.º 1
0
 void Update()
 {
     if (Application.isPlaying)
     {
         if (currentMode != NodeEditorMode.Simulation)
         {
             Repaint();
         }
         if (currentMode == NodeEditorMode.NewTransition)
         {
             CancelTransitioning();
         }
         if (currentHFSM != null && currentHFSM.CurrentState != null)
         {
             if (runningState != currentHFSM.CurrentState)
             {
                 runningState = currentHFSM.CurrentState;
                 Repaint();
             }
         }
         currentMode = NodeEditorMode.Simulation;
     }
     else if (Application.isEditor && currentMode == NodeEditorMode.Simulation)
     {
         currentMode = NodeEditorMode.Editing;
         Repaint();
     }
     if (EditorWindow.focusedWindow == this &&
         EditorWindow.mouseOverWindow == this &&
         currentMode == NodeEditorMode.NewTransition)
     {
         Repaint();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Fills the editor with updates nodes.
        /// </summary>
        public void UpdateNodes()
        {
            parentHFSM.Clear();

            if (Selection.activeTransform == null)
            {
                currentMode = NodeEditorMode.Empty;
                return;
            }

            Behaviour bc = Selection.activeTransform.gameObject.GetComponent <Behaviour>();

            //Stop if no active transform or behaviour on active object.
            if (bc == null)
            {
                currentMode = NodeEditorMode.Empty;
                return;
            }

            //Set to editing mode.
            if (currentMode == NodeEditorMode.Empty)
            {
                currentMode = NodeEditorMode.Editing;
            }
            // bc.GetHFSM().Reset();
            currentHFSM = null;
            //currentHFSM = bc.GetHFSM();
            if (bc.TopHFSM == null)
            {
                bc.TopHFSM           = Selection.activeGameObject.AddComponent <HFSM>();
                bc.TopHFSM.hideFlags = HideFlags.HideInInspector;
            }
            FillFromHFSM(bc.TopHFSM);
            Repaint();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Stop making new transition.
 /// </summary>
 void CancelTransitioning()
 {
     currentMode = NodeEditorMode.Editing;
     UpdateOutsiderNode();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Start creating a new transition.
 /// </summary>
 /// <param name="id">Id of window.</param>
 void NewTransitionCallBack(object node)
 {
     newTransitionFrom = (Node)node;
     currentMode       = NodeEditorMode.NewTransition;
 }