Beispiel #1
0
        private void InitNeighbours()
        {
            HexBoardNeighbours neighboursCalc = new HexBoardNeighbours(this.Size);

            // init the cached neighbours arrays
            this.neighbours         = new Cell[this.Size, this.Size][];
            this.neighbours2        = new Cell[this.Size, this.Size][][];
            this.playerXBetweenEdge = new Cell[this.Size, this.Size][];
            this.playerYBetweenEdge = new Cell[this.Size, this.Size][];

            foreach (Cell cell in this.cells)
            {
                Location[] neigbourLocations = neighboursCalc.Neighbours(cell.Location);
                this.neighbours[cell.X, cell.Y] = this.GetCellAt(neigbourLocations);

                Location[][] neighbour2Locations = neighboursCalc.Neighbours2(cell.Location);
                this.neighbours2[cell.X, cell.Y] = this.GetCellsAt(neighbour2Locations);

                Location[] localPlayerXBetweenEdge = neighboursCalc.BetweenEdge(cell.Location, true);
                this.playerXBetweenEdge[cell.X, cell.Y] = this.GetCellAt(localPlayerXBetweenEdge);

                Location[] localPlayerYBetweenEdge = neighboursCalc.BetweenEdge(cell.Location, false);
                this.playerYBetweenEdge[cell.X, cell.Y] = this.GetCellAt(localPlayerYBetweenEdge);
            }
        }
Beispiel #2
0
        private void InitNeighbours()
        {
            HexBoardNeighbours neighboursCalc = new HexBoardNeighbours(this.Size);

            // init the cached neighbours arrays
            this.neighbours = new Cell[this.Size, this.Size][];
            this.neighbours2 = new Cell[this.Size, this.Size][][];
            this.playerXBetweenEdge = new Cell[this.Size, this.Size][];
            this.playerYBetweenEdge = new Cell[this.Size, this.Size][];

            foreach (Cell cell in this.cells)
            {
                Location[] neigbourLocations = neighboursCalc.Neighbours(cell.Location);
                this.neighbours[cell.X, cell.Y] = this.GetCellAt(neigbourLocations);

                Location[][] neighbour2Locations = neighboursCalc.Neighbours2(cell.Location);
                this.neighbours2[cell.X, cell.Y] = this.GetCellsAt(neighbour2Locations);

                Location[] localPlayerXBetweenEdge = neighboursCalc.BetweenEdge(cell.Location, true);
                this.playerXBetweenEdge[cell.X, cell.Y] = this.GetCellAt(localPlayerXBetweenEdge);

                Location[] localPlayerYBetweenEdge = neighboursCalc.BetweenEdge(cell.Location, false);
                this.playerYBetweenEdge[cell.X, cell.Y] = this.GetCellAt(localPlayerYBetweenEdge);
            }
        }