示例#1
0
 bool isValidBlockPos()
 {
     foreach (Transform child in transform)
     {
         Vector2 block = PlaySquare.roundVector(child.position);
         if (!PlaySquare.insideField(block))
         {
             return(false);
         }
         if (PlaySquare.grid[(int)block.x, (int)block.y] != null &&
             PlaySquare.grid[(int)block.x, (int)block.y].parent != transform)
         {
             return(false);
         }
     }
     return(true);
 }
示例#2
0
 void updateGrid()
 {
     for (int y = 0; y < PlaySquare.height; y++)
     {
         for (int x = 0; x < PlaySquare.width; x++)
         {
             if (PlaySquare.grid[x, y] != null)
             {
                 if (PlaySquare.grid[x, y].parent == transform)
                 {
                     PlaySquare.grid[x, y] = null;
                 }
             }
         }
     }
     foreach (Transform child in transform)
     {
         Vector2 block = PlaySquare.roundVector(child.position);
         PlaySquare.grid[(int)block.x, (int)block.y] = child;
     }
 }