Esempio n. 1
0
    public void spawnNext()
    {
        BoxGroupFactory creatgroup = new CreatGroupFactoryByName(mans, btn_left, btn_right, btn_down, btn_row);

        if (IsDownItem)       //物品開關
        {
            int i = Random.Range(0, groups.Length + 1);
            if (i == groups.Length)
            {
                i = Random.Range(0, items.Length);
                creatgroup.setTarget(Instantiate(items[i], transform.position, Quaternion.identity));
                creatgroup.CreatGroupByName(BoxGroupFactory.GroupType.itemGroup);
            }
            else
            {
                creatgroup.setTarget(Instantiate(groups[i], transform.position, Quaternion.identity));
                creatgroup.CreatGroupByName(BoxGroupFactory.GroupType.normalGroup);
            }
        }
        else
        {
            int i = Random.Range(0, groups.Length);
            creatgroup.setTarget(Instantiate(groups[i], transform.position, Quaternion.identity));
            creatgroup.setBoxSkin(BoxSkin);
            creatgroup.CreatGroupByName(BoxGroupFactory.GroupType.normalGroup);
        }
    }
Esempio n. 2
0
    public void spawnCoin()
    {
        BoxGroupFactory creatgroup = new CreatGroupFactoryByName(mans, btn_left, btn_right, btn_down, btn_row);

        int times = Random.Range(0, 5 - Grid.getGrid.InitTimes + 1);

        for (int i = 0; i <= times; i++)
        {
            int x = Random.Range(0, Grid.getGrid.Width);
            int y = Random.Range(Grid.getGrid.Height_Now - Grid.getGrid.Height, Grid.getGrid.Height_Now);
            creatgroup.setTarget(Instantiate(coin, new Vector3(x, y, 0), Quaternion.identity));
            creatgroup.CreatGroupByName(BoxGroupFactory.GroupType.itemGroup);
        }
    }