Ejemplo n.º 1
0
 public bool CanFit(int offsetX, int offsetY, TriBlock toFit)
 {
     for (int y = 0; y < gridSize.y; y++)
     {
         for (int x = 0; x < gridSize.x; x++)
         {
             int      index        = y * gridSize.x + x;
             TriBlock block        = blocks[index];
             int      blockOffsetX = offsetX - x * 4;
             int      blockOffsetY = offsetY - y * 4;
             Debug.Log(block + "-------\n" + toFit.Shift(blockOffsetX, blockOffsetY));
             if (!block.CanFit(toFit.Shift(blockOffsetX, blockOffsetY)))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
    public TriBlock AddBlock(int offsetX, int offsetY, TriBlock block)
    {
        TriBlock result = new TriBlock();

        result.mask = this.mask;

        TriBlock shifted = block.Shift(offsetX, offsetY);

        result.mask |= shifted.mask;
        return(result);
    }