public static void Accept <T>( this ISyntaxNode node, VisitorFn <T> enter, VisitorFn <T> leave, Func <ISyntaxNode, VisitorAction> defaultAction) where T : ISyntaxNode => Accept( node, new VisitorFnWrapper <T>(enter, leave), _defaultVisitationMap, defaultAction);
public static void Accept <T>( this ISyntaxNode node, VisitorFn <T> enter, VisitorFn <T> leave, IVisitationMap visitationMap) where T : ISyntaxNode => Accept( node, new VisitorFnWrapper <T>(enter, leave), visitationMap, null);
public static void VisitTree(Node treeRoot, VisitorFn fn) { var children = treeRoot.GetChildren(); fn(treeRoot); // Walk children to add to the actors flat list. foreach (Node child in children) { VisitTree(child, fn); } }
public static void VisitTree(GameObject treeRoot, VisitorFn fn) { fn(treeRoot); // Walk children to add to the actors flat list. Transform transform = treeRoot.transform; for (int i = 0; i < transform.childCount; ++i) { var childGO = transform.GetChild(i).gameObject; VisitTree(childGO, fn); } }
public static void Accept <T>( this ISyntaxNode node, VisitorFn <T> enter, VisitorFn <T> leave) where T : ISyntaxNode => Accept <T>(node, enter, leave, _defaultVisitationMap);
public VisitorFnWrapper(VisitorFn <T> enter, VisitorFn <T> leave) { _enter = enter; _leave = leave; }