Exemplo n.º 1
0
    void GenerateNextBlock(GameObject currentBlock, out GameObject returnBlock)
    {
        int i              = groupBlock[numberGroup].Length - countRemainingBlock;
        int blockValue     = groupBlock[numberGroup][i];
        int indexNextBlock = blockValue / 100;

        Storage.CountBlockEarth = blockValue % 10;
        int       index = (blockValue / 10) % 10;
        GameBlock block = MessageSystemGameBlock.ReturnBlockFromGroup(indexNextBlock, index);

        GameObject    newBlock = block.GetGameObject();
        BoxCollider2D curBox   = currentBlock.GetComponent <BoxCollider2D>();
        float         offset   = 0;

        if (block.Extents != -1)
        {
            offset = curBox.bounds.extents.x + block.Extents;
        }
        else
        {
            GenerateNextEarth(currentBlock);
            Storage.CountBlockEarth++;
        }
        newBlock.transform.position = new Vector3(curBox.bounds.center.x + offset, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        block.SetActiveFull(true);
        returnBlock = newBlock;
    }