void MountedChildren(POCComponent node) { foreach (var child in node.Children) { MountedChildren(child); child.MountedBase(); } }
void DebugTree(POCComponent node) { Debug.Log($"Parent: {node.Parent}, Node: {node}, Child: {node.Children}"); foreach (var child in node.Children) { DebugTree(child); } }
/// <summary> /// Call child.Initialize() recursively by depth first /// </summary> /// <param name="node"></param> void InitializeChildren(Transform node, POCComponent parent) { var transform = node.transform; foreach (Transform child in transform) { var c = child.GetComponent <POCComponent>(); c?.InitializeBase(parent); InitializeChildren(child, c ?? parent); } }
public void InitializeBase(POCComponent parent) { if (!parent.IsShallowNode) { Parent = parent; } else { Parent = parent.Parent; } if (!IsShallowNode) { Parent.Children.Add(this); } Initialize(); }