Ejemplo n.º 1
0
 public MiddleGrid(Vector2 center)
 {
     centerGrid.type = 0;
     for (int i = 0; i < 4; i++)
     {
         edgeGrid[i].type = 1;
     }
     for (int i = 0; i < 4; i++)
     {
         cornerGrid[i].type = 2;
     }
     for (int i = 0; i < 3; i++)
     {
         for (int j = 0; j < 3; j++)
         {
             SmallGrid copy = this[i, j];
             copy.Create(this, center, i, j);
             this[i, j] = copy;
         }
     }
 }
Ejemplo n.º 2
0
 public SmallGrid this[int i, int j]
 {
     get
     {
         if (j == 1 && i == 1)
         {
             return(centerGrid);
         }
         else if (j == 2 && i == 1)
         {
             return(edgeGrid[0]);
         }
         else if (j == 1 && i == 2)
         {
             return(edgeGrid[1]);
         }
         else if (j == 0 && i == 1)
         {
             return(edgeGrid[2]);
         }
         else if (j == 1 && i == 0)
         {
             return(edgeGrid[3]);
         }
         else if (j == 2 && i == 2)
         {
             return(cornerGrid[0]);
         }
         else if (j == 0 && i == 2)
         {
             return(cornerGrid[1]);
         }
         else if (j == 0 && i == 0)
         {
             return(cornerGrid[2]);
         }
         else if (j == 2 && i == 0)
         {
             return(cornerGrid[3]);
         }
         else
         {
             throw new Exception();
         }
     }
     set
     {
         if (j == 1 && i == 1)
         {
             centerGrid = value;
         }
         else if (j == 2 && i == 1)
         {
             edgeGrid[0] = value;
         }
         else if (j == 1 && i == 2)
         {
             edgeGrid[1] = value;
         }
         else if (j == 0 && i == 1)
         {
             edgeGrid[2] = value;
         }
         else if (j == 1 && i == 0)
         {
             edgeGrid[3] = value;
         }
         else if (j == 2 && i == 2)
         {
             cornerGrid[0] = value;
         }
         else if (j == 0 && i == 2)
         {
             cornerGrid[1] = value;
         }
         else if (j == 0 && i == 0)
         {
             cornerGrid[2] = value;
         }
         else if (j == 2 && i == 0)
         {
             cornerGrid[3] = value;
         }
         else
         {
             throw new Exception();
         }
     }
 }