protectedoverride string[]GetTargetEvents(){returnnull;}//you don't need this in this case.
protectedoverride voidRegisterPorts(){
raised=AddFlowOutput("Out");
}
publicoverride voidOnGraphStarted(){
base.OnGraphStarted();//make sure to call base
target.value.Tapped+=EventRaised;
}
publicoverride voidOnGraphStoped(){
base.OnGraphStoped();//make sure to call base
target.value.Tapped-=EventRaised;
}
voidEventRaised(){
raised.Call(newFlow());
}
}
}
Notice that here, we instead derive from the generic class of EventNode, with an type argument of the type we need.
‘target.value’ gives you the actual component which is always the same type as the generic argument.
As with all the other event nodes, you can either leave the field in the node inspector empty to get the component automaticaly from the FlowScriptController gameobject, or you can assign a reference manualy.