Пример #1
0
    //Returns a flag indicating whether the specified blueprint connections match
    public static bool BlueprintConnectionsMatch(BlueprintConnection blueprintConnectionA, BlueprintConnection blueprintConnectionB)
    {
        //If the blueprint connections are not matching being invalid or valid
        if ((blueprintConnectionA != null) != (blueprintConnectionB != null))
        {
            //The blueprint connections do not match
            return(false);
        }

        //If the blueprint connections are valid
        if (blueprintConnectionA != null)
        {
            //If the blueprint connections are not the same type
            if (blueprintConnectionA.GetType() != blueprintConnectionB.GetType())
            {
                //The blueprint connections do not match
                return(false);
            }

            //If the blueprint connections do not match
            if (blueprintConnectionA.nodeID != blueprintConnectionB.nodeID ||
                blueprintConnectionA.sectionID != blueprintConnectionB.sectionID ||
                blueprintConnectionA.isInput != blueprintConnectionB.isInput ||
                blueprintConnectionA.connectionNodeID != blueprintConnectionB.connectionNodeID ||
                blueprintConnectionA.connectionSectionID != blueprintConnectionB.connectionSectionID ||
                blueprintConnectionA.connectionIsInput != blueprintConnectionB.connectionIsInput)
            {
                //The blueprint connections do not match
                return(false);
            }
        }

        //The blueprint connections match
        return(true);
    }
Пример #2
0
//If running in the Unity Editor
#if UNITY_EDITOR
    //Returns a flag indicating whether the specified blueprint connection can be connected to this blueprint connection
    protected override bool IsConnectable(BlueprintConnection blueprintConnection)
    {
        //If the specified blueprint connection is of type blueprint connection attribute input vector3
        if (blueprintConnection as BlueprintConnectionAttributeInputVector3 != null)
        {
            //The specified blueprint connection can be connected to this blueprint connection
            return(true);
        }

        //The specified blueprint connection can not be connected to this blueprint connection
        return(false);
    }
//If running in the Unity Editor
#if UNITY_EDITOR
    //Returns a flag indicating whether the specified blueprint connection can be connected to this blueprint connection
    protected override bool IsConnectable(BlueprintConnection blueprintConnection)
    {
        //If the specified blueprint connections is of type blueprint connection attribute output int
        if (blueprintConnection as BlueprintConnectionAttributeOutputInt != null)
        {
            //The specified blueprint connection can be connected to this blueprint connection
            return(true);
        }

        //The specified blueprint connection can not be connected to this blueprint connection
        return(false);
    }
    //Returns a flag indicating whether the specified blueprint connection can be connected to this blueprint connection
    protected override bool IsConnectable(BlueprintConnection blueprintConnection)
    {
        //If the specified blueprint connection is of type blueprint connection input execution
        if (blueprintConnection as BlueprintConnectionInputExecution != null)
        {
            //The specified blueprint connection can be connected to this blueprint connection
            return(true);
        }

        //The specified blueprint connection can not be connected to this blueprint connection
        return(false);
    }
//If running in the Unity Editor
#if UNITY_EDITOR
	//Returns a flag indicating whether the specified blueprint connection can be connected to this blueprint connection
	protected override bool IsConnectable(BlueprintConnection blueprintConnection)
	{
		//If the specified blueprint connection is of type blueprint connection attribute output button
		if (blueprintConnection as BlueprintConnectionAttributeOutputButton != null)
		{
			//The specified blueprint connection can be connected to this blueprint connection
			return true;
		}

		//The specified blueprint connection can not be connected to this blueprint connection
		return false;
	}
    //Makes a connection between the specified blueprint connection
    public void MakeConnection(BlueprintConnection blueprintConnection)
    {
        //Make local connection
        connectionNodeID    = BlueprintEditorManager.connection.nodeID;
        connectionSectionID = BlueprintEditorManager.connection.sectionID;
        connectionIsInput   = BlueprintEditorManager.connection.isInput;

        //Make external connection
        BlueprintEditorManager.connection.connectionNodeID    = nodeID;
        BlueprintEditorManager.connection.connectionSectionID = sectionID;
        BlueprintEditorManager.connection.connectionIsInput   = isInput;

        //Finalize connection
        BlueprintEditorManager.connection = null;
    }
    //Renders the blueprint connection link
    private void RenderBlueprintConnectionLink()
    {
        //If a connection link is possible
        if (connectionNodeID > -1)
        {
            //Query connection link
            BlueprintConnection connectionLink = BlueprintEditorManager.blueprint.GetBlueprintNodeAt(connectionNodeID).GetConnection(connectionSectionID, connectionIsInput);

            //If the connection link is valid
            if (connectionLink != null)
            {
                //Render the blueprint connection link
                Handles.DrawBezier(GetBlueprintConnectionLinkPosition(), connectionLink.GetBlueprintConnectionLinkPosition(), GetBlueprintConnectionLinkTangent(), connectionLink.GetBlueprintConnectionLinkTangent(), new Color(1.0f, 1.0f, 1.0f), Texture2D.whiteTexture, BlueprintStyleHelper.GetNodeConnectionLinkWidth());
            }
        }
    }
 //Returns a flag indicating whether the specified blueprint connection is connectable with this blueprint connection
 protected virtual bool IsConnectable(BlueprintConnection blueprintConnection)
 {
     //Return default result
     return(true);
 }