public Field(int size, int mines, Random random) { if (size < 1) { throw new ArgumentException(nameof(size)); } int count = Count(size); if (mines < 1 || mines * 2 >= count) { throw new ArgumentException(nameof(mines)); } HexaGrid grid = new HexaGrid(size); if (grid.Count != count) { throw new Exception(nameof(count)); } this.Grid = grid; this.mapping = new GridMapping(grid); this.random = random; this.MineGenerates = mines; Initialize(); }
public void newGrid() { Grids newGrid = new Grids(); CurrentGrid = new GridMapping(); newGrid.grid = CurrentGrid; GridList.Add(newGrid); }
// Start is called before the first frame update void Start() { if (tamplates == null) { tamplates = this; } Grids newGrid = new Grids(); CurrentGrid = new GridMapping(); newGrid.grid = CurrentGrid; GridList.Add(newGrid); Debug.Log(Tamplates.tamplates.CurrentGrid.storage.Count); }
public void GridMappingTest() { foreach (Grid grid in new Grid[] { new RectGrid(2, 2), new RectGrid(3, 2), new RectGrid(2, 3), new RectGrid(3, 3), new TriGrid(2), new TriGrid(3), new HexaGrid(2), new HexaGrid(3) }) { GridMapping mapping = new GridMapping(grid); Console.WriteLine(grid.ToString()); for (int y = 0; y < mapping.Height; y++) { for (int x = 0; x <= mapping.Width; x++) { Console.WriteLine($"{x},{y} : {mapping[x, y]}"); } Console.WriteLine(""); } Console.WriteLine("---------------------------"); } }
public AOI() { GridMapping = new GridMapping(this); Selected = false; }