public void Awake() { Answer = new List <string>(); subAnswer = new List <string>(); _Results.SetActive(false); ResButn.SetActive(false); _Canvas.SetActive(false); printedCol = false; buttons.Add(btnA); buttons.Add(btnB); buttons.Add(btnC); cubeNum = instructCanvas.GetComponentInChildren <Text>(); rend = Cubee.GetComponent <Renderer>(); colNum.GetComponent <Text>(); audioSource.GetComponent <AudioSource>(); }
public void NextColor() { if (i < 10) { colNum.text = "Choose Cube Color #" + (i + 1); audioSource.PlayOneShot(nextChoiceTick, 0.5f); int index = GetRandom(0, buttons.Count); switch (index) { case 0: btnA.image.color = colorsCorrect[i]; btnC.image.color = colorsDecoyA[i]; btnB.image.color = colorsDecoyB[i]; Debug.Log("A is Correct"); Answer.Add("A"); if (IsColorIdentical(colorsDecoyA[i], colorsDecoyB[i])) { Debug.Log("same ab"); btnC.image.color = Color.white; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyA[i])) { Debug.Log("same coA"); btnC.image.color = Color.gray; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyB[i])) { Debug.Log("same CoB"); btnB.image.color = Color.grey; } break; case 1: btnB.image.color = colorsCorrect[i]; btnA.image.color = colorsDecoyA[i]; btnC.image.color = colorsDecoyB[i]; Debug.Log("B is Correct"); Answer.Add("B"); if (IsColorIdentical(colorsDecoyA[i], colorsDecoyB[i])) { Debug.Log("same ab"); btnC.image.color = Color.yellow; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyA[i])) { Debug.Log("same coA"); btnA.image.color = Color.gray; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyB[i])) { Debug.Log("same CoB"); btnC.image.color = Color.white; } break; case 2: btnC.image.color = colorsCorrect[i]; btnB.image.color = colorsDecoyA[i]; btnA.image.color = colorsDecoyB[i]; Debug.Log("C is Correct"); Answer.Add("C"); if (IsColorIdentical(colorsDecoyA[i], colorsDecoyB[i])) { Debug.Log("same ab"); btnB.image.color = Color.grey; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyA[i])) { Debug.Log("same coA"); btnB.image.color = Color.white; } if (IsColorIdentical(colorsCorrect[i], colorsDecoyB[i])) { Debug.Log("same CoB"); btnA.image.color = Color.gray; } break; } done = false; i++; } else { colNum.text = "Finished"; ResButn.SetActive(true); } }