Ejemplo n.º 1
0
        public override void Draw()
        {
            if (!activated)
            {
                return;
            }
            Color GUIBackground = GUI.backgroundColor;

            GUI.backgroundColor = Style.Color;
            GUILayout.BeginArea(Rect, Skin.box);
            GUILayout.Label("Root");
            GUILayout.EndArea();
            GUI.backgroundColor = GUIBackground;
            //mandatory
            if (Port0 != null)
            {
                Port0.rect.y = Rect.y + (Rect.height * 0.5f) - Port0.rect.height * 0.5f;
                Port0.rect.y = Rect.y + Rect.height / 3f;
                Port0.rect.x = Rect.x - Port0.rect.width + 16f;
                Port0.Draw();
                GUI.Label(new Rect(Port0.rect.xMax, Port0.rect.y, 100, 15), "Mandatory");
            }
            // quality
            if (Port1 != null)
            {
                Port1.rect.y = Rect.y + (Rect.height * 0.5f) - Port1.rect.height * 0.5f;
                Port1.rect.y = Rect.y + (Rect.height / 3f) * 2;
                Port1.rect.x = Rect.x - Port1.rect.width + 16f;
                Port1.Draw();
                GUI.Label(new Rect(Port1.rect.xMax, Port1.rect.y, 100, 15), "Quality");
            }
            //action
            if (Port2 != null)
            {
                Port2.rect.y = Rect.y + (Rect.height * 0.66f) - Port2.rect.height * 0.5f;
                Port2.rect.y = Rect.y + Rect.height / 2f;
                Port2.rect.x = Rect.x + Rect.width - 16f;
                Port2.Draw();
                GUI.Label(new Rect(Port2.rect.xMax - 55, Port2.rect.y, 50, 15), "Action");
            }

            // update
            if (Port0 != null)
            {
                if (Port0.Connections.Count > 0)
                {
                    MandatoryID = Port0.Connections[0].outputPort.MyNode.Id;
                }
                else
                {
                    MandatoryID = -1;
                }
            }
            if (Port1 != null)
            {
                if (Port1.Connections.Count > 0)
                {
                    QualityID = Port1.Connections[0].outputPort.MyNode.Id;
                }
                else
                {
                    QualityID = -1;
                }
            }
            if (Port2 != null)
            {
                if (Port2.Connections.Count > 0)
                {
                    Action = (Port2.Connections[0].outputPort.MyNode as ActionShell).Action;
                }
            }

            // sent
            OnUpdateRoot(MandatoryID, QualityID, Rect.position);
        }