internal SandboxObjectReference NewChildSandboxObject(SandboxObjectReferenceData childSandboxObjectData, Vector3 position) { SandboxObjectReference childSandboxObject = (SandboxObjectReference)editable.NewSandboxObjectReference(childSandboxObjectData); childSandboxObject.gameObject.transform.position = position; return(childSandboxObject); }
internal override void PopulateData(ModuleData moduleData) { _data = (SandboxObjectReferenceData)moduleData; SandboxObjectData sandboxObjectData = ModuleHead.GetSandboxObjectDataById(GameHead.instance.universeData, _data.id); SpawnNestedModules(sandboxObjectData); ApplyData(); }
internal Module NewSandboxObjectReference(SandboxObjectReferenceData sandboxObjectReferenceData) { GameObject gameObject = Instantiate(ModuleHead.instance.GetModulePrefab(typeof(SandboxObjectReferenceData)).gameObject, this.transform); SandboxObjectReference sandboxObjectReference = gameObject.GetComponent <SandboxObjectReference>(); _idModuleMap.Add(sandboxObjectReferenceData.id, sandboxObjectReference); sandboxObjectReference.parent = this; sandboxObjectReference.PopulateData(sandboxObjectReferenceData); sandboxObjectReference.OnLoad(); return(sandboxObjectReference); }
private bool HasChildRecursive(SandboxObjectData sandboxObjectData, int id) { for (int i = 0; i < sandboxObjectData.modules.Count; i++) { if (!(sandboxObjectData.modules[i] is SandboxObjectReferenceData)) { continue; } SandboxObjectReferenceData childSandboxObjectData = (SandboxObjectReferenceData)sandboxObjectData.modules[i]; int childId = childSandboxObjectData.id; if (childId == id) { return(true); } bool overflow = HasChildRecursive(ModuleHead.GetSandboxObjectDataById(GameHead.instance.universeData, childId), id); if (overflow) { return(true); } } return(false); }
public SandboxObjectReferenceData(SandboxObjectReferenceData sandboxObjectReferenceData) { id = sandboxObjectReferenceData.id; name = sandboxObjectReferenceData.name; }