public void StartGame(int categoryIndex) { gameScore = 0; lifesRemaining = 3; currentTime = timeInSeconds; //set the questions data questions = new List <Question>(); dataScriptable = quizDataList[categoryIndex]; questions.AddRange(dataScriptable.questions); //select the question SelectQuestion(); gameStatus = GameStatus.PLAYING; }
// 相当于给private变量设置了修改接口 public void StartGame(int categoryIndex, string category) { currentCategory = category; // 设置游戏类型 correctAnswerCount = 0; gameScore = 0; lifesRemaining = 3; // 初始化游戏信息 currentTime = timeInSeconds; //set the questions data questions = new List <Question>(); dataScriptable = quizDataList[categoryIndex]; questions.AddRange(dataScriptable.questions); // 看起来像是一个从库函数里面抽取一个列表的函数 //select the question SelectQuestion(); gameStatus = GameStatus.PLAYING; // 修改游戏状态 }