예제 #1
0
        public LightTile[,] CreateGrid()
        {
            int distance = 10;
            int startXY = 5;

            for (int row = 0; row < this.grid.GetLength(0); row++)
            {
                for (int col = 0; col < this.grid.GetLength(1); col++)
                {
                    LightTile tempTile = new LightTile(this.onTileColor, this.offTileColor);
                    tempTile.Top = startXY + (row * this.buttonSize + distance);
                    tempTile.Left = startXY + (col * this.buttonSize + distance);
                    tempTile.Height = this.buttonSize;
                    tempTile.Width = this.buttonSize;

                    this.grid[row, col] = tempTile;
                }
            }

            return this.grid;
        }
예제 #2
0
 public void AddNeighbour(LightTile tile)
 {
     this.Neighbours.Add(tile);
 }
예제 #3
0
 private static void CreatePattern(LightTile[,] grid, Random rand)
 {
     int number;
     for (int row = 0; row < grid.GetLength(0) * 2; row++)
     {
         for (int col = 0; col < grid.GetLength(1) * 2; col++)
         {
             number = rand.Next(0, 200);
             if (number % 5 == 0)
                 grid[row % grid.GetLength(0), col % grid.GetLength(1)]
                     .SwitchLight();
         }
     }
 }