Esempio n. 1
0
    GameObject GenerateNextBlock(int index, GameObject currentBlock)
    {
        GameBlock     block    = MessageSystemGameBlock.ReturnDisactiveGameObject(index);
        GameObject    newBlock = block.GetGameObject();
        BoxCollider2D curBox   = currentBlock.GetComponent <BoxCollider2D>();
        float         offset   = 0;

        if (newBlock.name == "Barrier_Grey" || newBlock.name == "Portal_Grey")
        {
            Storage.CountTripleBlock = 3;
        }
        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);
        if (Storage.CountTripleBlock != 0)
        {
            Storage.CountTripleBlock--;
        }
        return(newBlock);
    }