Ejemplo n.º 1
0
        public XBehaviorMenu(XBehaviorStateNode currentNode = null)
        {
            GenericMenu menu = new GenericMenu();

            this.currentNode = currentNode;

            if (currentNode == null)
            {
                menu.AddItem(new GUIContent("Add State Node"), false, NoneCallback, "StateNode");
            }
            else
            {
                menu.AddItem(new GUIContent("Add DebugLog Action"), false, SelectedCallback, "DebugLog");
                menu.AddSeparator("");
                menu.AddItem(new GUIContent("Add Event"), false, SelectedCallback, "Event");
            }

            menu.ShowAsContext();
        }
Ejemplo n.º 2
0
 void ChooseNode(int finger)
 {
     if (Event.current.type == EventType.MouseDown)
     {
         if (!IsTransition)
         {
             for (int i = 0; i < allStateNode.Count; i++)
             {
                 //if( nodes[i] != null ) {
                 if (allStateNode[i].GraphRect.Contains(mousePosition))
                 {
                     mouseInNode   = allStateNode[i];
                     IsClickNode   = true;
                     SelectedIndex = i;
                     return;
                 }
                 //}
             }
             mouseInNode   = null;
             IsClickNode   = false;
             SelectedIndex = -1;
         }
         else
         {
             IsTransition = false;
             for (int i = 0; i < allStateNode.Count; i++)
             {
                 //if( nodes[i] != null ) {
                 if (allStateNode[i].GraphRect.Contains(mousePosition))
                 {
                     selectedEvent.nextState = allStateNode[i].state;
                     return;
                 }
                 //}
             }
             mouseInNode   = null;
             IsClickNode   = false;
             SelectedIndex = -1;
         }
     }
 }
Ejemplo n.º 3
0
 public void SetBehaviorEvent(XBehaviorEvent selectedEvent)
 {
     this.selectedEvent = selectedEvent;
     selectedNode       = this.mouseInNode;
     IsTransition       = true;
 }