void _UpdateColor(UpdateButtonColorEvent e) { r = (int)Random.Range(0f, colorBtns.Length - 0.1f); colorBtns[r].image.color = ballColors[e.correctColor]; //Debug.Log(e.correctColor); randomColors.Remove(e.correctColor); List <int> deletedColors = new List <int>(); deletedColors.Add(e.correctColor); for (int i = 0; i < colorBtns.Length; i++) { if (i != r) { int c = randomColors[(int)Random.Range(0f, randomColors.Count - 0.1f)]; colorBtns[i].image.color = ballColors[c]; randomColors.Remove(c); deletedColors.Add(c); } } randomColors.AddRange(deletedColors); deletedColors.Clear(); check = false; }
private void SelectColor(int color) { ballMesh.material = ballMats[color]; UpdateButtonColorEvent e = new UpdateButtonColorEvent(color); _EventBus.Publish <UpdateButtonColorEvent>(e); }