示例#1
0
    Ball.BALL_TYPE GetBallType()
    {
        var random = Random.Range(0.0f, 1.0f);

        if (random > changeTypeRate)
        {
            lastType = (Ball.BALL_TYPE)Random.Range(0, 5);
        }
        return(lastType);
    }
示例#2
0
    public void SetType(Ball.BALL_TYPE type)
    {
        foreach (var go in colorsGO)
        {
            go.SetActive(false);
        }

        this.type = type;

        colorsGO [(int)type].SetActive(true);
    }
示例#3
0
    void Start()
    {
        matchList = new List <Ball> ();
        lastType  = (Ball.BALL_TYPE)Random.Range(0, 5);
        typePool  = new List <Ball.BALL_TYPE> ();

        var i     = 0;
        var total = 10000;

        while (i < total)
        {
            typePool.Add(GetBallType());
            i++;
        }

        Shuffle(typePool);

        BuildGrid();
    }