Пример #1
0
 public void UpgradeGrid(Tetris_demo tetris)
 {
     for (int y = 0; y < gridheight; ++y)
     {
         for (int x = 0; x < gridwidth; ++x)
         {
             if (grid[x, y] != null)
             {
                 if (grid[x, y].parent == tetris.transform)
                 {
                     grid[x, y] = null;
                 }
             }
         }
     }
     foreach (Transform t in tetris.transform)
     {
         Vector2 pos      = Round(t.position);
         Vector3 grid_pos = g.transform.localPosition;
         //Debug.Log("grid_pos" + grid_pos + "  " + "pos" + pos);
         if (pos.y < gridheight + grid_pos.y + 1)
         {
             grid[(int)(pos.x - grid_pos.x - 1), (int)(pos.y - grid_pos.y - 1)] = t;
         }
     }
 }
Пример #2
0
    public bool CheckIsAboverid(Tetris_demo tetris)
    {
        Vector3 grid_pos = g.transform.localPosition;

        for (int x = 0; x < gridwidth; ++x)
        {
            foreach (Transform t in tetris.transform)
            {
                Vector3 pos = Round(t.position);
                if (pos.y > gridheight + grid_pos.y)
                {
                    return(true);
                }
            }
        }
        return(false);
    }