8
8
9
9
namespace NodeGraphProcessor . Examples
10
10
{
11
- [ System . Serializable ]
12
- /// <summary>
13
- /// This is the base class for every node that is executed by the conditional processor, it takes an executed bool as input to
14
- /// </summary>
15
- public abstract class ConditionalNode : BaseNode , IConditionalNode
16
- {
17
- // These booleans will controls wether or not the execution of the folowing nodes will be done or discarded.
18
- [ Input ( name = "Executed" , allowMultiple = true ) ]
19
- public ConditionalLink executed ;
11
+ [ System . Serializable ]
12
+ /// <summary>
13
+ /// This is the base class for every node that is executed by the conditional processor, it takes an executed bool as input to
14
+ /// </summary>
15
+ public abstract class ConditionalNode : BaseNode , IConditionalNode
16
+ {
17
+ // These booleans will controls wether or not the execution of the folowing nodes will be done or discarded.
18
+ [ MultiEdgeInput ( name = "Executed" ) ]
19
+ public ConditionalLink executed ;
20
20
21
- public abstract IEnumerable < ConditionalNode > GetExecutedNodes ( ) ;
21
+ public abstract IEnumerable < ConditionalNode > GetExecutedNodes ( ) ;
22
22
23
- // Assure that the executed field is always at the top of the node port section
24
- public override FieldInfo [ ] GetNodeFields ( )
25
- {
26
- var fields = base . GetNodeFields ( ) ;
27
- Array . Sort ( fields , ( f1 , f2 ) => f1 . Name == nameof ( executed ) ? - 1 : 1 ) ;
28
- return fields ;
29
- }
30
- }
23
+ // Assure that the executed field is always at the top of the node port section
24
+ public override FieldInfo [ ] GetNodeFields ( )
25
+ {
26
+ var fields = base . GetNodeFields ( ) ;
27
+ Array . Sort ( fields , ( f1 , f2 ) => f1 . Name == nameof ( executed ) ? - 1 : 1 ) ;
28
+ return fields ;
29
+ }
30
+ }
31
31
32
- [ System . Serializable ]
33
- /// <summary>
34
- /// This class represent a simple node which takes one event in parameter and pass it to the next node
35
- /// </summary>
36
- public abstract class LinearConditionalNode : ConditionalNode , IConditionalNode
37
- {
38
- [ Output ( name = "Executes" ) ]
39
- public ConditionalLink executes ;
32
+ [ System . Serializable ]
33
+ /// <summary>
34
+ /// This class represent a simple node which takes one event in parameter and pass it to the next node
35
+ /// </summary>
36
+ public abstract class LinearConditionalNode : ConditionalNode , IConditionalNode
37
+ {
38
+ [ Output ( name = "Executes" ) ]
39
+ public ConditionalLink executes ;
40
40
41
- public override IEnumerable < ConditionalNode > GetExecutedNodes ( )
42
- {
43
- // Return all the nodes connected to the executes port
44
- return outputPorts . FirstOrDefault ( n => n . fieldName == nameof ( executes ) )
45
- . GetEdges ( ) . Select ( e => e . inputNode as ConditionalNode ) ;
46
- }
47
- }
48
-
49
- [ System . Serializable ]
50
- /// <summary>
51
- /// This class represent a waitable node which invokes another node after a time/frame
52
- /// </summary>
53
- public abstract class WaitableNode : LinearConditionalNode
54
- {
55
- [ Output ( name = "Execute After" ) ]
56
- public ConditionalLink executeAfter ;
41
+ public override IEnumerable < ConditionalNode > GetExecutedNodes ( )
42
+ {
43
+ // Return all the nodes connected to the executes port
44
+ return outputPorts . FirstOrDefault ( n => n . fieldName == nameof ( executes ) )
45
+ . GetEdges ( ) . Select ( e => e . inputNode as ConditionalNode ) ;
46
+ }
47
+ }
57
48
58
- protected void ProcessFinished ( )
59
- {
60
- onProcessFinished . Invoke ( this ) ;
61
- }
49
+ [ System . Serializable ]
50
+ /// <summary>
51
+ /// This class represent a waitable node which invokes another node after a time/frame
52
+ /// </summary>
53
+ public abstract class WaitableNode : LinearConditionalNode
54
+ {
55
+ [ Output ( name = "Execute After" ) ]
56
+ public ConditionalLink executeAfter ;
62
57
63
- [ HideInInspector ]
64
- public Action < WaitableNode > onProcessFinished ;
58
+ protected void ProcessFinished ( )
59
+ {
60
+ onProcessFinished . Invoke ( this ) ;
61
+ }
65
62
66
- public IEnumerable < ConditionalNode > GetExecuteAfterNodes ( )
67
- {
68
- return outputPorts . FirstOrDefault ( n => n . fieldName == nameof ( executeAfter ) )
69
- . GetEdges ( ) . Select ( e => e . inputNode as ConditionalNode ) ;
70
- }
71
- }
63
+ [ HideInInspector ]
64
+ public Action < WaitableNode > onProcessFinished ;
65
+
66
+ public IEnumerable < ConditionalNode > GetExecuteAfterNodes ( )
67
+ {
68
+ return outputPorts . FirstOrDefault ( n => n . fieldName == nameof ( executeAfter ) )
69
+ . GetEdges ( ) . Select ( e => e . inputNode as ConditionalNode ) ;
70
+ }
71
+ }
72
72
}
0 commit comments