private GameObject ProcessDynamicLoaderNode(DynamicLoader node, NodeHandle nodeHandle) { // Possibly we can add action interfaces for dyn load childs as they will get traversable if they have node actons if (NodeUtils.FindGameObjectsUnsafe(node.GetNativeReference(), out List <GameObject> list)) { return(list[0]); // We are already in list, lets return first object wich is our main registered node } // We are not registered NodeUtils.AddGameObjectReferenceUnsafe(node.GetNativeReference(), nodeHandle.gameObject); nodeHandle.inNodeUtilsRegistry = true; // Added to registry return(null); }
private void ProcessPendingLoaders() { foreach (NodeLoadInfo nodeLoadInfo in pendingLoaders) { if (nodeLoadInfo.state == DynamicLoadingState.LOADED) // We got a callback from dyn loader that we were loaded or unloaded { unTransform transform = NodeUtils.FindFirstGameObjectTransformUnsafe(nodeLoadInfo.loader.GetNativeReference()); if (transform == null) // We have been unloaded or not registered { continue; } if (transform.childCount != 0) // We have already a child and our sub graph was loaded { continue; } // TODO: Active state node can be further up the tree and should be located and passed here GameObject go = BeginTraverse(nodeLoadInfo.node, true); // Build sub graph as result of dynamic loader if (go != null) { go.transform.SetParent(transform, false); // Connect to our parent } } else if (nodeLoadInfo.state == DynamicLoadingState.UNLOADED) { List <GameObject> list; if (NodeUtils.FindGameObjectsUnsafe(nodeLoadInfo.loader.GetNativeReference(), out list)) { foreach (var go in list) { //We need to unload all limked go in hierarchy var tr = go.transform; for (var i = tr.childCount - 1; i >= 0; i--) { Free(tr.GetChild(i)); } } } } } pendingLoaders.Clear(); }
private void ProcessPendingActivations() { foreach (ActivationInfo activationInfo in pendingActivations) { List <GameObject> list; // We need to activate the correct nodes if (NodeUtils.FindGameObjectsUnsafe(activationInfo.node.GetNativeReference(), out list)) { foreach (GameObject obj in list) { if (activationInfo.state == NodeActionEvent.IS_TRAVERSABLE) { obj.SetActive(true); } else { obj.SetActive(false); } } } } pendingActivations.Clear(); }