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); }
public void SetType(Ball.BALL_TYPE type) { foreach (var go in colorsGO) { go.SetActive(false); } this.type = type; colorsGO [(int)type].SetActive(true); }
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(); }