コード例 #1
0
    public Quest_2 GetRandom(bool remove = true)
    {
        if (questionList.Count == 0)
        {
            SceneManager.LoadScene("MainMenu");
        }
        int index = Random.Range(0, questionList.Count);

        if (!remove)
        {
            return(questionList[index]);
        }
        Quest_2 q = questionList[index];

        questionList.RemoveAt(index);
        return(q);
    }
コード例 #2
0
 public void Construct(Quest_2 op, Action <OptionSelect_2> callback)
 {
     question.text = op.text;
     if (op.n == 1)
     {
         img.sprite   = Resources.Load <Sprite>("Img/Conteo/obj_1");
         img_2.sprite = Resources.Load <Sprite>("Img/Conteo/obj_2");
     }
     else if (op.n == 2)
     {
         img.sprite   = Resources.Load <Sprite>("Img/Conteo/obj_2");
         img_2.sprite = Resources.Load <Sprite>("Img/Conteo/obj_1");
     }
     for (int n = 0; n < btnList.Count; n++)
     {
         btnList[n].Construct(op.options[n], callback);
     }
 }