예제 #1
0
    IEnumerator createServerRow(float delay, ServerBlank sBlank)
    {
        Transform parent = Instantiate(emptyGM, cursor, Quaternion.identity).transform;
        Vector3   r      = cursor;

        for (int i = 0; i < sBlank.fields.Count; i++)
        {
            ServerBlock b  = sBlank.fields [i];
            GameObject  go = Instantiate(BlocksContainer.instanse.blocks[b.blockID], new Vector3(r.x + b.x, r.y + b.y - 1, 0), b.rotate, parent);
            if (BlocksContainer.instanse.blocks[b.blockID].tag != "Spike")
            {
                checkPlaceForIdol(go);
            }
            if (BlockObject.count % BlockList.instance.spawnChestRate == 0)
            {
                checkPlaceChest = true;
            }
            if (checkPlaceChest)
            {
                checkPlaceForChest(go);
            }

            BlockObject.count++;

            go.GetComponent <BlockObject> ().index = BlockObject.count;
            createdBlock.Add(go.GetComponent <BlockObject> ());
            yield return(new WaitForSeconds(delay));

            //yield return new WaitForEndOfFrame();
        }
        yield break;
    }
예제 #2
0
    public void createServerBlankNoTimer(ServerBlank blank)
    {
        Transform parent = Instantiate(emptyGM, cursor, Quaternion.identity).transform;
        Vector3   r      = cursor;

        for (int i = 0; i < blank.fields.Count; i++)
        {
            ServerBlock b  = blank.fields [i];
            GameObject  go = Instantiate(BlocksContainer.instanse.blocks[b.blockID], new Vector3(r.x + b.x, r.y + b.y, 0), b.rotate, parent);
            //checkPlaceForIdol (go.transform.position);
            BlockObject.count++;
            go.GetComponent <BlockObject> ().index = BlockObject.count;
            createdBlock.Add(go.GetComponent <BlockObject> ());
        }
        cursor -= Vector3.up * (blank.ySize - 1);
    }
예제 #3
0
    public void createBlank(int blankId)
    {
        createdBlocks.Clear();
        destroyGrid();
        blank      = user.packs[openPackId].blanks[blankId];
        selectedId = blankId;
        drawBorder();

        buildGrid();


        if (blankInBuild != null)
        {
            Destroy(blankInBuild);
        }
        if (blankObject != null)
        {
            Destroy(blankObject);
        }
        blankObject = Instantiate(emptyPrefab, Vector3.zero, Quaternion.identity);
        Vector3 r = startPos;

        for (int i = 0; i < blank.fields.Count; i++)
        {
            ServerBlock b  = blank.fields [i];
            GameObject  go = Instantiate(BlocksContainer.instanse.blocks [b.blockID], new Vector3(r.x + b.x, r.y + b.y, zPos), b.rotate, blankObject.transform);
            gridBlocks [b.x, -b.y].GetComponent <PointTrigger>().child = go;
            createdBlocks.Add(go);
        }
        if (gridBlocks[0, 0].GetComponent <PointTrigger>().child == null)
        {
            for (int i = 0; i < blank.xSize; i++)
            {
                for (int j = 0; j < blank.ySize; j++)
                {
                    if (i == 0 || i == blank.xSize - 1)
                    {
                        GameObject go = Instantiate(BlocksContainer.instanse.blocks [0], new Vector3(r.x + i, r.y - j, zPos), BlocksContainer.instanse.blocks [0].transform.rotation, blankObject.transform);
                        gridBlocks [i, j].GetComponent <PointTrigger>().child = go;
                        createdBlocks.Add(go);
                    }
                }
            }
        }
    }