コード例 #1
0
    private void ToggleSetGlobalFlag(bool record = true)
    {
        if (record)
        {
            HistoryManager.RecordNode(this);
        }

        nodeType = NodeType.SetGlobalFlag;
        title    = "SET GLOBAL FLAG";

        style         = new GUIStyle(SDEStyles.nodeSmallDefault);
        defaultStyle  = new GUIStyle(SDEStyles.nodeSmallDefault);
        selectedStyle = new GUIStyle(SDEStyles.nodeSmallSelected);

        rect.width       = NodeManager.FLAG_WIDTH;
        rect.height      = NodeManager.FLAG_HEIGHT;
        clickRect.width  = NodeManager.FLAG_WIDTH;
        clickRect.height = NodeManager.FLAG_HEIGHT;

        outPoint = ScriptableObject.CreateInstance <ConnectionPoint>();
        outPoint.Init(this, ConnectionPointType.Out);

        globalItemDropdown = ScriptableObject.CreateInstance <DropdownGlobalItemBox>();
        globalItemDropdown.Init();

        // bind the dropdown to the global flag list
        globalItemDropdown.LoadItems(GlobalFlags.flags);
    }
コード例 #2
0
    private void ToggleSetLocalFlag(bool record = true)
    {
        if (record)
        {
            HistoryManager.RecordNode(this);
        }

        nodeType = NodeType.SetLocalFlag;
        title    = "SET LOCAL FLAG";

        style         = new GUIStyle(SDEStyles.nodeSmallDefault);
        defaultStyle  = new GUIStyle(SDEStyles.nodeSmallDefault);
        selectedStyle = new GUIStyle(SDEStyles.nodeSmallSelected);

        rect.width       = NodeManager.FLAG_WIDTH;
        rect.height      = NodeManager.FLAG_HEIGHT;
        clickRect.width  = NodeManager.FLAG_WIDTH;
        clickRect.height = NodeManager.FLAG_HEIGHT;

        outPoint = ScriptableObject.CreateInstance <ConnectionPoint>();
        outPoint.Init(this, ConnectionPointType.Out);

        localFlagDropdown = ScriptableObject.CreateInstance <DropdownLocalFlagBox>();
        localFlagDropdown.Init();

        // bind the dropdown menu to the main editor's local flag list
        localFlagDropdown.LinkFlags(NodeManager.mainEditor.localFlagsMenu.items);
    }
コード例 #3
0
    public void Draw()
    {
        if (readyToInit && !initialized)
        {
            Init();
            inPoint.Init();
            outPoint.Init();
        }
        else
        {
            Handles.DrawBezier(
                inPoint.rect.center,
                outPoint.rect.center,
                inPoint.rect.center + Vector2.down * 50f,
                outPoint.rect.center - Vector2.down * 50f,
                Color.white,
                null,
                2f
                );

            if (Handles.Button((inPoint.rect.center + outPoint.rect.center) * 0.5f, Quaternion.identity, 4, 8, Handles.RectangleHandleCap))
            {
                if (OnClickRemoveConnection != null)
                {
                    OnClickRemoveConnection(this);
                }
            }
        }
    }
コード例 #4
0
    private void ToggleInterrupt()
    {
        nodeType = NodeType.Interrupt;
        title    = "-->";

        style         = SDEStyles.nodeSmallDefault;
        defaultStyle  = SDEStyles.nodeSmallDefault;
        selectedStyle = SDEStyles.nodeSmallSelected;

        outPoint = ScriptableObject.CreateInstance <ConnectionPoint>();
        outPoint.Init(this, ConnectionPointType.Out);
    }
コード例 #5
0
    private void ToggleSetGlobalVariable(bool record = true)
    {
        if (record)
        {
            HistoryManager.RecordNode(this);
        }

        nodeType = NodeType.SetGlobalVariable;
        title    = "SET GLOBAL VARIABLE";

        ToggleGlobalVariable();

        outPoint = ScriptableObject.CreateInstance <ConnectionPoint>();
        outPoint.Init(this, ConnectionPointType.Out);
    }
コード例 #6
0
    public void SetBottomLevelInterrupt(bool bottomLevel)
    {
        // mark this as a bottom level Interrupt Node
        this.bottomLevel = bottomLevel;

        // clear any connections that were there if no longer a bottom level
        if (!bottomLevel && outPoint != null)
        {
            List <Connection> connectionsToRemove = outPoint.connections;
            for (int i = 0; i < connectionsToRemove.Count; i++)
            {
                ConnectionManager.RemoveConnection(connectionsToRemove[i], markHistory: true);
            }

            // clear outpoint reference
            outPoint.connections.Clear();
            outPoint = null;
        }
        else if (bottomLevel && outPoint == null)
        {
            outPoint = ScriptableObject.CreateInstance <ConnectionPoint>();
            outPoint.Init(this, ConnectionPointType.Out);
        }
    }