mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 01:36:03 +08:00
Fixed #134 - Marked some more methods as virtual
This commit is contained in:
parent
4cf7113740
commit
eb164225c8
@ -11,7 +11,7 @@ namespace XNode {
|
|||||||
/// See: <see cref="AddNode{T}"/> </summary>
|
/// See: <see cref="AddNode{T}"/> </summary>
|
||||||
[SerializeField] public List<Node> nodes = new List<Node>();
|
[SerializeField] public List<Node> nodes = new List<Node>();
|
||||||
|
|
||||||
/// <summary> Add a node to the graph by type </summary>
|
/// <summary> Add a node to the graph by type (convenience method - will call the System.Type version) </summary>
|
||||||
public T AddNode<T>() where T : Node {
|
public T AddNode<T>() where T : Node {
|
||||||
return AddNode(typeof(T)) as T;
|
return AddNode(typeof(T)) as T;
|
||||||
}
|
}
|
||||||
@ -37,14 +37,14 @@ namespace XNode {
|
|||||||
|
|
||||||
/// <summary> Safely remove a node and all its connections </summary>
|
/// <summary> Safely remove a node and all its connections </summary>
|
||||||
/// <param name="node"> The node to remove </param>
|
/// <param name="node"> The node to remove </param>
|
||||||
public void RemoveNode(Node node) {
|
public virtual void RemoveNode(Node node) {
|
||||||
node.ClearConnections();
|
node.ClearConnections();
|
||||||
nodes.Remove(node);
|
nodes.Remove(node);
|
||||||
if (Application.isPlaying) Destroy(node);
|
if (Application.isPlaying) Destroy(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Remove all nodes and connections from the graph </summary>
|
/// <summary> Remove all nodes and connections from the graph </summary>
|
||||||
public void Clear() {
|
public virtual void Clear() {
|
||||||
if (Application.isPlaying) {
|
if (Application.isPlaying) {
|
||||||
for (int i = 0; i < nodes.Count; i++) {
|
for (int i = 0; i < nodes.Count; i++) {
|
||||||
Destroy(nodes[i]);
|
Destroy(nodes[i]);
|
||||||
@ -54,7 +54,7 @@ namespace XNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Create a new deep copy of this graph </summary>
|
/// <summary> Create a new deep copy of this graph </summary>
|
||||||
public XNode.NodeGraph Copy() {
|
public virtual XNode.NodeGraph Copy() {
|
||||||
// Instantiate a new nodegraph instance
|
// Instantiate a new nodegraph instance
|
||||||
NodeGraph graph = Instantiate(this);
|
NodeGraph graph = Instantiate(this);
|
||||||
// Instantiate all nodes inside the graph
|
// Instantiate all nodes inside the graph
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user