コード例 #1
0
    public void SetType(Bubble.BUBBLE_TYPE type)
    {
        foreach (GameObject go in bubblesGO)
        {
            go.SetActive(false);
        }

        this.type = type;

        bubblesGO[(int)type].SetActive(true);
    }
コード例 #2
0
    Bubble.BUBBLE_TYPE GetBubbleType()
    {
        float random = Random.Range(0.0f, 1.0f);

        //changeTypeRate ensures difficulty of level if its small value then the bubbles will be more of similar colours
        if (random > changeTypeRate)
        {
            lastType = (Bubble.BUBBLE_TYPE)Random.Range(0, 7);
            //randomizing only to 7(which is 128) because I dont want bigger numbers to appear on grid
        }
        return(lastType);
    }
コード例 #3
0
    void Start()
    {
        matchList      = new List <Bubble>();
        lastType       = (Bubble.BUBBLE_TYPE)Random.Range(0, 7);
        bubbleTypePool = new List <Bubble.BUBBLE_TYPE>();
        //approximately creating a 10000 bubble type for the level
        int i     = 0;
        int total = 10000;

        while (i < total)
        {
            bubbleTypePool.Add(GetBubbleType());
            i++;
        }

        Shuffle(bubbleTypePool);

        BuildGrid();
    }