Class Graph

class Graph

This class represents an InstantTerra graph.

InstantTerra instantTerra = new InstantTerra();  // Start the instance
Project project = instantTerra.GetProject();  // Get the current project
Graph graph = instantTerra.GetProject().GetGraph();  // Get the graph

enum Graph.NodeLocation

This enum represents the location of a node from another node.

  • Top
  • TopRight
  • BottomRight
  • Bottom
  • BottomLeft
  • Left
  • TopLeft

int GetNodeCount ()

Returns

Number of nodes in the graph.

Returns the number of nodes in the graph.

int nodeCount = graph.GetNodeCount();

List<Node> GetAllNodes ()

Returns

List of nodes.

Returns the list of nodes in the graph.

List<Node> nodes = graph.GetAllNodes();

List<NodeModel> GetNodeModels ()

Returns

List of node models.

Returns the list of node models.

List<NodeModel> nodes = graph.GetNodeModels();

Node AddNode (ApiNodeType nodeType, int positionX, int positionY)

Returns

The created Node.

Creates and returns the node on the graph.

Node newNode = graph.AddNode(ApiNodeType.PerlinNoise, 10, 10);

Node AddNodeFromModel (NodeModel nodeModel, int positionX, int positionY)

Returns

The created Node.

Creates and returns the node from the node model on the graph.

Node newNode = graph.AddNodeFromModel(perlinNodeModel, 10, 10);

Node AddNodeNextTo (ApiNodeType nodeType, Graph.NodeLocation nodeLocation, Node previousNode)

Returns

The created Node.

Creates and returns the node on the graph next to the specified node.

Node newNode = graph.AddNodeNextTo(ApiNodeType.PerlinNoise, NodeLocation.Right, previousNode);

Node AddNodeFromModelNextTo (NodeModel nodeModel, Graph.NodeLocation nodeLocation, Node previousNode)

Returns

The created Node.

Creates and returns the node on the graph next to the specified node.

Node newNode = graph.AddNodeFromModelNextTo(perlinNodeModel, NodeLocation.Right, previousNode);

Node RemoveNode (Node nodeToRemove)

Removes the Node from the graph.

graph.RemoveNode(nodeToRemove);

List<Link> GetNodeLinks (Node node)

Returns

List of links.

Returns the list of node links.

List<Link> links = graph.GetNodeLinks(perlinNoiseNode);

Link AddLink (Node startNode, Connector startConnector, Node endNode, Connector endConnector)

Returns

The created link.

Adds a link between nodes

Link link = graph.AddLink(startNode, startConnector, endNode, endConnector);
Link AddLinkUsingName (Node startNode,

string startConnectorName, Node endNode, string endConnectorName)

Returns

The created link.

Adds a link between nodes

Link link = graph.AddLinkUsingName(startNode, startConnectorName, endNode, endConnectorName);

bool RemoveLink (Link linkToRemove)

Returns

true if the link has been removed

Remove a link

graph.RemoveLink(link);

bool IsGraphAvailable ()

Returns

True if the graph exists, otherwise False.

Returns the status of the graph.

bool isAvailable = graph.IsGraphAvailable();

Copyright © 2022 · All Rights Reserved · Wysilab