Ejemplo n.º 1
0
 public void UpgradeGrid(Tetris2 tetris)
 {
     for (int y = 0; y < gridheight2; ++y)
     {
         for (int x = 0; x < gridwidth2; ++x)
         {
             if (grid2[x, y] != null)
             {
                 if (grid2[x, y].parent == tetris.transform)
                 {
                     grid2[x, y] = null;
                 }
             }
         }
     }
     foreach (Transform t in tetris.transform)
     {
         Vector2 pos = Round(t.position);
         //Debug.Log("grid_pos" + grid_pos + "  " + "pos" + pos);
         if (pos.y < gridheight2 + grid_pos.y + 1)
         {
             grid2[(int)(pos.x - grid_pos.x - 1), (int)(pos.y - grid_pos.y - 1)] = t;
         }
     }
 }
Ejemplo n.º 2
0
 public bool CheckIsAboverid(Tetris2 tetris)
 {
     for (int x = 0; x < gridwidth2; ++x)
     {
         foreach (Transform t in tetris.transform)
         {
             Vector3 pos = Round(t.position);
             if (pos.y > gridheight2 + grid_pos.y)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
    public void Minosave(Tetris2 tetris)
    {
        Vector3 block_pos = save.transform.position;
        Vector3 pos       = new Vector3((float)(block_pos.x), (float)(block_pos.y + 2.5), 0);

        swaptime++;
        Debug.Log(swaptime);
        if (swaptime > maxswap)
        {
            return;
        }

        if (minotemp2 == null)
        {
            minotemp2 = tetris;
            minotemp2.transform.position = pos;
            minotemp2.enabled            = false;
            minotemp2.tag = "currentsavemino2";
            NextTetrisp1();
        }
        else
        {
            Tetris2 t = minotemp2;
            minotemp2 = tetris;
            minotemp2.transform.position = pos;
            minotemp2.enabled            = false;
            minotemp2.tag        = "currentsavemino2";
            t.transform.position = new Vector3(Mathf.Round((gridwidth2 + 2 * (grid_pos.x)) / 2), (float)(gridheight2 + 1 + grid_pos.y), grid_pos.z);;
            t.enabled            = true;
            t.tag = "currentactivemino2";
            Destroy(GameObject.FindGameObjectWithTag("current_ghost2"));
            ghost = (GameObject)Instantiate(GameObject.FindGameObjectWithTag("currentactivemino2"), GameObject.FindGameObjectWithTag("currentactivemino2").transform.position, Quaternion.identity);
            Destroy(ghost.GetComponent <Tetris2>());
            ghost.AddComponent <Ghost2>();
        }
    }