using UnityEngine;using System.Collections;using UnityEngine.UI;using System.Collections.Generic;public class CircuitControl : MonoBehaviour{ public List RBsprites = new List();//存放红黑触笔的图片 private int[] Choice1 = new int[60]; private int[] Choice2 = new int[60]; public string ChoiceFir; public string ChoiceSec; void Start() { //生成答案选项 CheckChoice(); } //////生成问题答案选项 /// void CheckChoice() { //生成随机数,根据数值判断ABCD; Random choice = new Random();//生成答案选项 //生成16个随机数 for (int i = 0; i < 60; i++) { Choice1[i] = Random.Range(0, 100);//随机生成0-100之间的数 } for (int j = 0; j < 60; j++) { Choice2[j] = Random.Range(0, 100);//随机生成0-100之间的数 } //根据随机生成数值的大小决定ABCD四个选项,即ChoiceFir(第一个正确选项)/ChoiceSec(第二个正确选项)表示选择题答案的两个正确选项(AD 或 BC)。 //第一组正确选项 AD for (int i = 0; i < 60; i++) { if (Choice1[i] < 50) { ChoiceFir = "A"; for (int j = 0; j < 60; j++) { if (Choice1[j] < 50) { ChoiceSec = "D"; } } } } //第二组正确选项 BC for (int i = 0; i < 60; i++) { if (Choice1[i] > 50) { ChoiceFir = "B"; for (int j = 0; j < 60; j++) { if (Choice1[j] > 50) { ChoiceSec = "C"; } } } } }}