Platformer Pro  2.3.2
A platform game kit for Unity.
XNode.Node Class Reference

Base class for all nodes More...

Inheritance diagram for XNode.Node:
PlatformerPro.AI.Actions.EnemyAction PlatformerPro.AI.Actions.EnemyDamageFilter PlatformerPro.AI.ChangePhaseNode PlatformerPro.AI.EnemyEntryNode PlatformerPro.AI.EnemyNode PlatformerPro.AI.Interrupts.EnemyInterruptAttackedNode PlatformerPro.AI.Interrupts.EnemyInterruptCounter PlatformerPro.AI.Interrupts.EnemyInterruptDamagedNode PlatformerPro.AI.Interrupts.EnemyInterruptEnemyMessage PlatformerPro.AI.Interrupts.EnemyInterruptHealth PlatformerPro.AI.Interrupts.EnemyInterruptTimer PlatformerPro.Dialog.ActionNode PlatformerPro.Dialog.DialogEntryNode PlatformerPro.Dialog.DialogEventNode PlatformerPro.Dialog.DialogNode PlatformerPro.Dialog.EventResponseNode

Classes

class  CreateNodeMenuAttribute
 
class  InputAttribute
 Mark a serializable field as an input port. You can access this through GetInputPort(string) More...
 
class  NodeTintAttribute
 
class  NodeWidthAttribute
 
class  OutputAttribute
 Mark a serializable field as an output port. You can access this through GetOutputPort(string) More...
 

Public Types

enum class  ShowBackingValue { Never , Unconnected , Always }
 Used by InputAttribute and OutputAttribute to determine when to display the field value associated with a NodePort More...
 
enum class  ConnectionType { Multiple , Override }
 
enum class  TypeConstraint { None , Inherited , Strict , InheritedInverse }
 Tells which types of input to allow More...
 

Public Member Functions

NodePort AddInstanceInput (Type type, Node.ConnectionType connectionType=Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint=TypeConstraint.None, string fieldName=null)
 
NodePort AddInstanceOutput (Type type, Node.ConnectionType connectionType=Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint=TypeConstraint.None, string fieldName=null)
 
void RemoveInstancePort (string fieldName)
 
void RemoveInstancePort (NodePort port)
 
void ClearInstancePorts ()
 
void UpdateStaticPorts ()
 Update static ports to reflect class fields. This happens automatically on enable. More...
 
void VerifyConnections ()
 Checks all connections for invalid references, and removes them. More...
 
NodePort AddDynamicInput (Type type, Node.ConnectionType connectionType=Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint=TypeConstraint.None, string fieldName=null)
 Convenience function. More...
 
NodePort AddDynamicOutput (Type type, Node.ConnectionType connectionType=Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint=TypeConstraint.None, string fieldName=null)
 Convenience function. More...
 
void RemoveDynamicPort (string fieldName)
 Remove an dynamic port from the node More...
 
void RemoveDynamicPort (NodePort port)
 Remove an dynamic port from the node More...
 
void ClearDynamicPorts ()
 Removes all dynamic ports from the node More...
 
NodePort GetOutputPort (string fieldName)
 Returns output port which matches fieldName More...
 
NodePort GetInputPort (string fieldName)
 Returns input port which matches fieldName More...
 
NodePort GetPort (string fieldName)
 Returns port which matches fieldName More...
 
bool HasPort (string fieldName)
 
GetInputValue< T > (string fieldName, T fallback=default(T))
 Return input value for a specified port. Returns fallback value if no ports are connected More...
 
T[] GetInputValues< T > (string fieldName, params T[] fallback)
 Return all input values for a specified port. Returns fallback value if no ports are connected More...
 
virtual object GetValue (NodePort port)
 Returns a value based on requested port output. Should be overridden in all derived nodes with outputs. More...
 
virtual void OnCreateConnection (NodePort from, NodePort to)
 Called after a connection between two NodePorts is created More...
 
virtual void OnRemoveConnection (NodePort port)
 Called after a connection is removed from this port More...
 
void ClearConnections ()
 Disconnect everything from this node More...
 

Public Attributes

NodeGraph graph
 Parent NodeGraph More...
 
Vector2 position
 Position on the NodeGraph More...
 

Static Public Attributes

static NodeGraph graphHotfix
 Used during node instantiation to fix null/misconfigured graph during OnEnable/Init. Set it before instantiating a node. Will automatically be unset during OnEnable More...
 

Protected Member Functions

void OnEnable ()
 
virtual void Init ()
 Initialize node. Called on enable. More...
 

Properties

IEnumerable< NodePortInstancePorts [get]
 
IEnumerable< NodePortInstanceOutputs [get]
 
IEnumerable< NodePortInstanceInputs [get]
 
IEnumerable< NodePortPorts [get]
 Iterate over all ports on this node. More...
 
IEnumerable< NodePortOutputs [get]
 Iterate over all outputs on this node. More...
 
IEnumerable< NodePortInputs [get]
 Iterate over all inputs on this node. More...
 
IEnumerable< NodePortDynamicPorts [get]
 Iterate over all dynamic ports on this node. More...
 
IEnumerable< NodePortDynamicOutputs [get]
 Iterate over all dynamic outputs on this node. More...
 
IEnumerable< NodePortDynamicInputs [get]
 Iterate over all dynamic inputs on this node. More...
 

Detailed Description

Base class for all nodes

Classes extending this class will be considered as valid nodes by xNode.

[System.Serializable]
public class Adder : Node {
[Input] public float a;
[Input] public float b;
[Output] public float result;
// GetValue should be overridden to return a value for any specified output port
public override object GetValue(NodePort port) {
return a + b;
}
}
virtual object GetValue(NodePort port)
Returns a value based on requested port output. Should be overridden in all derived nodes with output...
Definition: Node.cs:244

Member Enumeration Documentation

◆ ConnectionType

Enumerator
Multiple 

Allow multiple connections

Override 

always override the current connection

◆ ShowBackingValue

Used by InputAttribute and OutputAttribute to determine when to display the field value associated with a NodePort

Enumerator
Never 

Never show the backing value

Unconnected 

Show the backing value only when the port does not have any active connections

Always 

Always show the backing value

◆ TypeConstraint

Tells which types of input to allow

Enumerator
None 

Allow all types of input

Inherited 

Allow connections where input value type is assignable from output value type (eg. ScriptableObject --> Object)

Strict 

Allow only similar types

InheritedInverse 

Allow connections where output value type is assignable from input value type (eg. Object --> ScriptableObject)

Member Function Documentation

◆ AddDynamicInput()

NodePort XNode.Node.AddDynamicInput ( Type  type,
Node.ConnectionType  connectionType = Node.ConnectionType.Multiple,
Node.TypeConstraint  typeConstraint = TypeConstraint.None,
string  fieldName = null 
)

Convenience function.

See also
AddInstancePort, AddInstanceOutput

◆ AddDynamicOutput()

NodePort XNode.Node.AddDynamicOutput ( Type  type,
Node.ConnectionType  connectionType = Node.ConnectionType.Multiple,
Node.TypeConstraint  typeConstraint = TypeConstraint.None,
string  fieldName = null 
)

Convenience function.

See also
AddInstancePort, AddInstanceInput

◆ AddInstanceInput()

NodePort XNode.Node.AddInstanceInput ( Type  type,
Node.ConnectionType  connectionType = Node.ConnectionType.Multiple,
Node.TypeConstraint  typeConstraint = TypeConstraint.None,
string  fieldName = null 
)

◆ AddInstanceOutput()

NodePort XNode.Node.AddInstanceOutput ( Type  type,
Node.ConnectionType  connectionType = Node.ConnectionType.Multiple,
Node.TypeConstraint  typeConstraint = TypeConstraint.None,
string  fieldName = null 
)

◆ ClearConnections()

void XNode.Node.ClearConnections ( )

Disconnect everything from this node

◆ ClearDynamicPorts()

void XNode.Node.ClearDynamicPorts ( )

Removes all dynamic ports from the node

◆ ClearInstancePorts()

void XNode.Node.ClearInstancePorts ( )

◆ GetInputPort()

NodePort XNode.Node.GetInputPort ( string  fieldName)

Returns input port which matches fieldName

◆ GetInputValue< T >()

T XNode.Node.GetInputValue< T > ( string  fieldName,
fallback = default(T) 
)

Return input value for a specified port. Returns fallback value if no ports are connected

Parameters
fieldNameField name of requested input port
fallbackIf no ports are connected, this value will be returned

◆ GetInputValues< T >()

T [] XNode.Node.GetInputValues< T > ( string  fieldName,
params T[]  fallback 
)

Return all input values for a specified port. Returns fallback value if no ports are connected

Parameters
fieldNameField name of requested input port
fallbackIf no ports are connected, this value will be returned

◆ GetOutputPort()

NodePort XNode.Node.GetOutputPort ( string  fieldName)

Returns output port which matches fieldName

◆ GetPort()

NodePort XNode.Node.GetPort ( string  fieldName)

Returns port which matches fieldName

◆ GetValue()

◆ HasPort()

bool XNode.Node.HasPort ( string  fieldName)

◆ Init()

virtual void XNode.Node.Init ( )
protectedvirtual

◆ OnCreateConnection()

virtual void XNode.Node.OnCreateConnection ( NodePort  from,
NodePort  to 
)
virtual

Called after a connection between two NodePorts is created

Parameters
fromOutput
toInput

◆ OnEnable()

void XNode.Node.OnEnable ( )
protected

◆ OnRemoveConnection()

virtual void XNode.Node.OnRemoveConnection ( NodePort  port)
virtual

Called after a connection is removed from this port

Parameters
portOutput or Input

◆ RemoveDynamicPort() [1/2]

void XNode.Node.RemoveDynamicPort ( NodePort  port)

Remove an dynamic port from the node

◆ RemoveDynamicPort() [2/2]

void XNode.Node.RemoveDynamicPort ( string  fieldName)

Remove an dynamic port from the node

◆ RemoveInstancePort() [1/2]

void XNode.Node.RemoveInstancePort ( NodePort  port)

◆ RemoveInstancePort() [2/2]

void XNode.Node.RemoveInstancePort ( string  fieldName)

◆ UpdateStaticPorts()

void XNode.Node.UpdateStaticPorts ( )

Update static ports to reflect class fields. This happens automatically on enable.

◆ VerifyConnections()

void XNode.Node.VerifyConnections ( )

Checks all connections for invalid references, and removes them.

Member Data Documentation

◆ graph

NodeGraph XNode.Node.graph

Parent NodeGraph

◆ graphHotfix

NodeGraph XNode.Node.graphHotfix
static

Used during node instantiation to fix null/misconfigured graph during OnEnable/Init. Set it before instantiating a node. Will automatically be unset during OnEnable

◆ position

Vector2 XNode.Node.position

Position on the NodeGraph

Property Documentation

◆ DynamicInputs

IEnumerable<NodePort> XNode.Node.DynamicInputs
get

Iterate over all dynamic inputs on this node.

◆ DynamicOutputs

IEnumerable<NodePort> XNode.Node.DynamicOutputs
get

Iterate over all dynamic outputs on this node.

◆ DynamicPorts

IEnumerable<NodePort> XNode.Node.DynamicPorts
get

Iterate over all dynamic ports on this node.

◆ Inputs

IEnumerable<NodePort> XNode.Node.Inputs
get

Iterate over all inputs on this node.

◆ InstanceInputs

IEnumerable<NodePort> XNode.Node.InstanceInputs
get

◆ InstanceOutputs

IEnumerable<NodePort> XNode.Node.InstanceOutputs
get

◆ InstancePorts

IEnumerable<NodePort> XNode.Node.InstancePorts
get

◆ Outputs

IEnumerable<NodePort> XNode.Node.Outputs
get

Iterate over all outputs on this node.

◆ Ports

IEnumerable<NodePort> XNode.Node.Ports
get

Iterate over all ports on this node.


The documentation for this class was generated from the following file: