Exemple #1
0
    public void loadAll()
    {
        float posY = 0;

        for (int i = 0; i < serialization.blockCount(); ++i, posY -= 50f)
        {
            GameObject buffer = Instantiate(listPrefab) as GameObject;
            buffer.transform.SetParent(blocksContainer);
            buffer.transform.localScale    = new Vector3(1, 1, 1);
            buffer.transform.localPosition = new Vector3(0, 100 + posY, 0);

            buffer.GetComponent <BlockOnList>().load(i);
        }
    }
Exemple #2
0
    public void randNew()
    {
        if (transform.childCount > 0)
        {
            foreach (Transform obj in transform)
            {
                Destroy(obj.gameObject);
            }
        }
        int index = Random.Range(0, serialization.blockCount());

        GameObject buffer = BlockDeserialization.CreateBlock(index, BlockDeserialization.createMode.STANDARD);

        buffer.transform.SetParent(transform);
        buffer.transform.localPosition = new Vector2(0, 0);
        buffer.transform.localScale    = new Vector3(0.5f, 0.5f, 0.5f);

        buffer.GetComponent <Block>().randColor();
        buffer.GetComponent <Block>().enabled = false;
    }