Ejemplo n.º 1
0
        public override void Init()
        {
            cells = new Dictionary <ulong, Cell>();
            uint rings = parameters.rings;

            for (int q = (int)(-rings); q <= rings; q++)
            {
                int r1 = (int)Math.Max(-rings, -q - rings);
                int r2 = (int)Math.Min(rings, -q + rings);

                for (int r = r1; r <= r2; r++)
                {
                    cells.Add(Cantor.Pairing(q, r), CreateCellAtPosition(new HexagonalPosition(q, r)));
                }
            }

            base.Init();
        }
Ejemplo n.º 2
0
        public override void Init()
        {
            cells = new Dictionary <ulong, Cell>();

            for (int i = 0; i < parameters.shape.Width; i++)
            {
                for (int j = 0; j < parameters.shape.Height; j++)
                {
                    RectangularPosition pos = new RectangularPosition(i, j);

                    if (parameters.shape.ContainsAtPosition(pos))
                    {
                        cells.Add(Cantor.Pairing(i, j), CreateCellAtPosition(pos));
                    }
                }
            }

            base.Init();
        }
Ejemplo n.º 3
0
 protected override Cell CellAtPosition(RectangularPosition position)
 {
     return(cells[Cantor.Pairing(position.x, position.y)]);
 }
Ejemplo n.º 4
0
 public override int GetHashCode()
 {
     return((int)Cantor.Pairing(q, r));
 }
Ejemplo n.º 5
0
 protected override Cell CellAtPosition(HexagonalPosition position)
 {
     return(cells[Cantor.Pairing(position.q, position.r)]);
 }
Ejemplo n.º 6
0
 protected override bool ContainsAtPosition(HexagonalPosition position)
 {
     return(cells.ContainsKey(Cantor.Pairing(position.q, position.r)));
 }