public void TearDownSimulation() { if (!isSetUp) { return; } isSetUp = false; Wire.GlobalTearDown(); Grid grid = Grid.Instance; Transmitter tr = null; for (int i = 0; i < grid.Height; i++) { for (int j = 0; j < grid.Width; j++) { GameObject g = grid.GetGridComponent(i, j); if (g == null) { continue; } tr = g.GetComponent <Transmitter>(); if (tr != null) { tr.Reset(); } } } if (ColumnManager.LevelIOMask[0]) { grid.GetGridComponent(0, grid.Height - 1).GetComponent <Importer>().ResetState(); } if (ColumnManager.LevelIOMask[1]) { grid.GetGridComponent(0, 0).GetComponent <Importer>().ResetState(); } if (ColumnManager.LevelIOMask[2]) { grid.GetGridComponent(grid.Width - 1, 0).GetComponent <Exporter>().ResetState(); } if (ColumnManager.LevelIOMask[3]) { grid.GetGridComponent(grid.Width - 1, grid.Height - 1).GetComponent <Exporter>().ResetState(); } ColManager.SetTestIndex(0); ValueDisplayManager.DestroyAllValueDisplays(); for (int i = 0; i < TestCaseCompletion.Length; i++) { TestCaseCompletion[i] = false; } levelWon = false; }
public void ClearGrid() { GameObject g = null; ValueDisplayManager.DestroyAllValueDisplays(); for (int i = 0; i < Height; i++) { for (int j = 0; j < Width; j++) { DestroyGridComponent(i, j); } } }
public void SoftReset() { //Reset simulation, does not reset test completion Wire.GlobalTearDown(); Grid grid = Grid.Instance; Transmitter tr = null; for (int i = 0; i < grid.Height; i++) { for (int j = 0; j < grid.Width; j++) { GameObject g = grid.GetGridComponent(i, j); if (g == null) { continue; } tr = g.GetComponent <Transmitter>(); if (tr != null) { tr.Reset(); } } } if (ColumnManager.LevelIOMask[0]) { grid.GetGridComponent(0, grid.Height - 1).GetComponent <Importer>().ResetState(); } if (ColumnManager.LevelIOMask[1]) { grid.GetGridComponent(0, 0).GetComponent <Importer>().ResetState(); } if (ColumnManager.LevelIOMask[2]) { grid.GetGridComponent(grid.Width - 1, 0).GetComponent <Exporter>().ResetState(); } if (ColumnManager.LevelIOMask[3]) { grid.GetGridComponent(grid.Width - 1, grid.Height - 1).GetComponent <Exporter>().ResetState(); } ValueDisplayManager.DestroyAllValueDisplays(); isSetUp = true; Grid.Instance.ClearGroupSelection(); Wire.GlobalSetUp(); displayManager.AddAllValueDisplays(); }