Пример #1
0
 public void SetNull(Tetromino_1 tet)
 {
     foreach (Transform mino in tet.transform)
     {
         Vector2 pos = GridPosition(mino.position);
         grid[(int)pos.x, (int)pos.y] = null;
     }
 }
Пример #2
0
    /*public bool CheckSpawn(Tetromino_1 t)
     * {
     *  print(t.transform.position);
     *  foreach (Transform mino in t.transform)
     *  {
     *      Vector2 a = new Vector2(mino.position.x - 10f, mino.position.y);
     *
     *      Vector2 pos = FindObjectOfType<Game_1>().GridPosition(a);
     *      print(pos);
     *      if (FindObjectOfType<Game_1>().GetGridPosition(pos) != null)
     *      {
     *          return false;
     *      }
     *  }
     *  return true;
     * }*/

    private void AddBlocks(List <Tetromino_1> T, Tetromino_1 a1,
                           Tetromino_1 a2, Tetromino_1 a3, Tetromino_1 a4,
                           Tetromino_1 a5, Tetromino_1 a6, Tetromino_1 a7)
    {
        T.Add(a1);
        T.Add(a2);
        T.Add(a3);
        T.Add(a4);
        T.Add(a5);
        T.Add(a6);
        T.Add(a7);
    }
Пример #3
0
    public void UpdateGrid(Tetromino_1 t)
    {
        for (int y = 0; y < 25; y++)
        {
            for (int x = 0; x < 10; x++)
            {
                if (grid[x, y] != null)
                {
                    if (grid[x, y].parent == t.transform)
                    {
                        grid[x, y] = null;
                    }
                }
            }
        }

        foreach (Transform mino in t.transform)
        {
            Vector2 pos = GridPosition(mino.position);
            grid[(int)pos.x, (int)pos.y] = mino;
        }
    }
Пример #4
0
 public void SetHold(Tetromino_1 tet)
 {
     hold = true;
     t    = tet;
 }