Пример #1
0
 /// <summary>
 /// Проверка на превышение верхней границы грид
 /// </summary>
 /// <param name="tetromino"></param>
 /// <returns></returns>
 public bool CheckIsAboveGrid(TetroMino tetromino)
 {
     foreach (Transform mino in tetromino.transform)
     {
         Point pos = ReverseVector(TetroMino.positionDeterminationMino(mino));
         if (pos.j > GridHeight - 1)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
    /// <summary>
    /// запись в Grid новых Tetromino
    /// </summary>
    /// <param name="tetroMino"></param>
    public void UpdateGrid(TetroMino tetroMino)
    {
        for (int y = 0; y < GridHeight; y++)
        {
            for (int x = 0; x < GridWeight; x++)
            {
                if (grid[x, y] != null && grid[x, y].parent == tetroMino.transform)
                {
                    grid[x, y] = null;
                }
            }
        }

        foreach (Transform mino in tetroMino.transform)
        {
            Point pos = ReverseVector(TetroMino.positionDeterminationMino(mino));
            if (pos.j < GridHeight)
            {
                grid[(int)pos.i, (int)pos.j] = mino;
            }
        }
    }