Beispiel #1
0
        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();
        }
Beispiel #2
0
    public void newGrid()
    {
        Grids newGrid = new Grids();

        CurrentGrid = new GridMapping();

        newGrid.grid = CurrentGrid;
        GridList.Add(newGrid);
    }
Beispiel #3
0
    // 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);
    }
Beispiel #4
0
        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("---------------------------");
            }
        }
Beispiel #5
0
 public AOI()
 {
     GridMapping = new GridMapping(this);
     Selected    = false;
 }