public static void QueryComponents(JEGameObject jgo) { // for every registered conversion get that component foreach (KeyValuePair <Type, Type> pair in conversions) { Component[] components = jgo.unityGameObject.GetComponents(pair.Key); foreach (Component component in components) { MeshRenderer meshRenderer = component as MeshRenderer; if (meshRenderer != null && !meshRenderer.enabled) { continue; } var jcomponent = Activator.CreateInstance(pair.Value) as JEComponent; if (jcomponent == null) { ExportError.FatalError("Export component creation failed"); } jcomponent.unityComponent = component; jcomponent.jeGameObject = jgo; jgo.AddComponent(jcomponent); } } }
static void reset() { JEResource.Reset(); JEComponent.Reset(); JEScene.Reset(); JEGameObject.Reset(); JEComponent.RegisterStandardComponents(); }
static JEGameObject Traverse(GameObject obj, JEGameObject jparent = null) { JEGameObject jgo = new JEGameObject(obj, jparent); foreach (Transform child in obj.transform) { Traverse(child.gameObject, jgo); } return(jgo); }
public JEGameObject(GameObject go, JEGameObject parent) { GameObjectLookup[go] = this; this.unityGameObject = go; this.parent = parent; this.name = go.name; if (parent != null) { parent.children.Add(this); } JEComponent.QueryComponents(this); }