Example #1
0
 public override GameObject Generate(GameObject currentBlock)
 {
     newBlock.transform.position = new Vector3(currentBlock.transform.position.x + Earth.Delta, newBlock.transform.position.y, newBlock.transform.position.z);
     MessageSystemGameBlock.SetupParent(newBlock, false);
     newBlock.SetActive(true);
     return(newBlock);
 }
Example #2
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;
    }
Example #3
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);
    }
Example #4
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        GameObject currentBlock = collision.gameObject;

        newBlock.transform.position = new Vector3(currentBlock.transform.position.x + Earth.Delta, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, true);
        newBlock.SetActive(true);
    }
Example #5
0
    protected GameObject GenerateNextEarth(GameObject currentBlock)
    {
        Storage.CountBlockEarth--;
        GameBlock  block    = MessageSystemGameBlock.ReturnDisactiveDownEarth();
        GameObject newBlock = block.GetGameObject();

        block.SetActiveFull(true);
        float         deltaMinus = -0.065f;
        BoxCollider2D curBox     = currentBlock.GetComponent <BoxCollider2D>();
        BoxCollider2D newBox     = newBlock.GetComponent <BoxCollider2D>();
        float         delta      = curBox.bounds.extents.x + newBox.bounds.extents.x + deltaMinus;

        newBlock.transform.position = new Vector3(curBox.bounds.center.x + delta, newBlock.transform.position.y, newBlock.transform.position.z);
        MessageSystemGameBlock.SetupParent(newBlock, false);
        return(newBlock);
    }
Example #6
0
    void GenerateNextBlock(GameObject currentBlock, out GameObject returnBlock)
    {
        int       index = 1;
        GameBlock block = new GameBlock();

        for (int i = 0; i < 3; i++)
        {
            Randomizer(ref index);
            block = MessageSystemGameBlock.ReturnUnusedGameBlock(index);
            if (block.GetGameObject() != null)
            {
                selectedBlock[index - 1] = true;
                StartCoroutine(PreparingPercent(index));
                break;
            }
            if (i == 2)
            {
                returnBlock             = GenerateNextEarth(currentBlock);
                Storage.CountBlockEarth = 0;
                return;
            }
        }
        block.CountUsing++;
        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;
    }