Ejemplo n.º 1
0
 // del start nnvu Delete amin
 //Animator anim;
 // del end nnvu
 void Start()
 {
     //hand = GameObject.Find("1:1");
     //for (int i = 0; i < block.Length; i++)
     //{
     //	anim =block[i].GetComponent<Animator>();
     //	anim.SetInteger("Color", 4);
     //}
     if (block != null)
     {
         // del start nnvu remove SetInvalid
         //SetValid();
         // del end nnvu remve SetInvalid
         for (int jj = 0; jj < height; jj++)
         {
             if ((jj % 2 == 0) && (jj != 0))
             {
                 col += xOffset;
             }
             for (int ii = 0; ii < width; ii++)
             {
                 // mod start nnvu Change Block Status Precreate
                 // if (Invalid[jj, ii] == 0)
                 if (Invalid[jj, ii] != 0)
                 // mod end
                 {
                     GameObject hex_go;
                     // mod start nnvu Change How to create Base
                     //if (jj % 2 == 0)
                     //{
                     //    hex_go = (GameObject)Instantiate(
                     //        block,
                     //        new Vector2(ii * xOffset - 5.5f + col, jj * yOffset - 7*yOffset / 2f),
                     //        Quaternion.identity);
                     //}
                     //else
                     //{
                     //    hex_go = (GameObject)Instantiate(
                     //        block,
                     //        new Vector2(ii * xOffset + xOffset / 2 - 5.5f + col, jj * yOffset - 7*yOffset / 2f),
                     //        Quaternion.identity);
                     //}
                     hex_go = (GameObject)Instantiate(
                         block,
                         new Vector2(
                             ii * xOffset - 5.5f + col + (jj % 2) * xOffset / 2f,
                             jj * yOffset + 3f + 0.6f),
                         Quaternion.identity);
                     // mod end nnvu
                     hex_go.name = "Base_" + ii + "_" + jj;
                     hex_go.transform.SetParent(this.transform);
                     // add start nnvu set Status as create Block
                     BlockOj hexScript = (BlockOj)hex_go.GetComponent(typeof(BlockOj));
                     hexScript.SetStatus(Invalid[jj, ii]);
                     // add end nnvu
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        #region Block
        if (block != null)
        {
            for (int jj = 0; jj < height; jj++)
            {
                if ((jj % 2 == 0) && (jj != 0))
                {
                    col += xOffset;
                }
                for (int ii = 0; ii < width; ii++)
                {
                    if (Invalid[jj, ii] != 0)

                    {
                        GameObject hex_go;

                        hex_go = (GameObject)Instantiate(
                            block,
                            new Vector2(
                                ii * xOffset - 5.5f + col + (jj % 2) * xOffset / 2f,
                                jj * yOffset + 3f + 0.6f),
                            Quaternion.identity);
                        hex_go.name = "Base_" + ii + "_" + jj;
                        hex_go.transform.SetParent(this.transform);
                        // add start nnvu set Status as create Block
                        BlockOj hexScript = (BlockOj)hex_go.GetComponent(typeof(BlockOj));
                        hexScript.SetStatus(Invalid[jj, ii]);
                    }
                }
            }
        }
        #endregion

        #region Draw
        _drawer = Instantiate(Drawer);
        _drawer.transform.SetParent(this.transform);
        _drawer.name = "Drawer";
        #endregion

        #region Card
        _sCard = Card;
        wid    = Card.GetComponent <SpriteRenderer>().bounds.size.x + 0.05f;
        _sWid  = wid;
        for (int i = 0; i < 5; i++)
        {
            _card      = Instantiate(Card, new Vector2(-8f + (wid * i), -4f), Quaternion.identity);
            _card.name = "card_" + i.ToString();
            _card.transform.SetParent(this.transform.Find("Drawer"));
        }
        CardNumber = 5;
        #endregion
    }