public void LocalDelete() { GlobalReferences.DeletePart(id); if (!PlacementReferences.InfiniteParts && Respawn) { GameObject go = PartsHolder.Holder.SpawnPart(GetComponent <Part>().TemplateID); go.GetComponent <Part>().Respawn = true; } }
public void Engage() { switch (GlobalReferences.PlacementType) { case PlacementTypeTool.PlaceChoreo.Place: { FreezeObject(); break; } case PlacementTypeTool.PlaceChoreo.Choreo: { GlobalReferences.DriftApartFac = 1; break; } case PlacementTypeTool.PlaceChoreo.PickNChose: { if (pickup != null) { PickupPart(); } else if (pickupCarry != null && pickup == null) { ReleasePart(); } break; } case PlacementTypeTool.PlaceChoreo.Delete: { if (toDelete != null) { GlobalReferences.DeletePart((int)toDelete.GetComponent <Part>().ID); } break; } case PlacementTypeTool.PlaceChoreo.DisableScanning: { trigger.Enable = true; trigger.Triggered = true; break; } } }
static void Export(TIExportAR exportItem) { if (GlobalReferences.FrozenParts.Count > 1) { int k = 0; foreach (int kk in GlobalReferences.FrozenParts.Keys) { if (kk > k) { k = kk; } } GlobalReferences.DeletePart(k); ParentAndSimulate(exportItem, true); --expCount; } else { exportItem.ResetTool(); simulationInProgress = false; int k = 0; foreach (int i in GlobalReferences.FrozenParts.Keys) { k = i; } GlobalReferences.DeletePart(k); expCount = 0; AssemblyIO.Load(expTempPath); ControllerReferences.ControllerTarget.SetActive(true); } }
public static void NewGame() { if (BoltNetwork.IsRunning) { var newGame = NewGameEvent.Create(); newGame.Send(); return; } List <GameObject> tempGos = new List <GameObject>(); tempGos.AddRange(GlobalReferences.FreeParts); tempGos.AddRange(GlobalReferences.AffectedParts); foreach (GameObject go in GlobalReferences.FrozenParts.Values) { tempGos.Add(go); } for (int i = tempGos.Count - 1; i >= 0; --i) { if (tempGos[i].GetComponent <Part>().ID != -1) { GlobalReferences.DeletePart((int)tempGos[i].GetComponent <Part>().ID); } else { MonoBehaviour.Destroy(tempGos[i]); } } GlobalReferences.FreeParts.Clear(); GlobalReferences.FrozenParts.Clear(); GlobalReferences.AffectedParts.Clear(); GlobalReferences.NumOfParts = 0; GlobalReferences.Parts.Clear(); GlobalReferences.PartSpawner.SpawnMultiple(PartsHolder.NumParts); }