Esempio n. 1
0
    void Begin()
    {
        //Gets a link to the TriviaReferences script
        refs = gameObject.GetComponent<TriviaReferences>();
        //		canvasObject = GameObject.Find("Canvas");
        button1 = GameObject.Find("Answer1Button");
        button2 = GameObject.Find("Answer2Button");
        button3 = GameObject.Find("Answer3Button");
        button4 = GameObject.Find("Answer4Button");

        button1Text = button1.GetComponentInChildren<Text>();
        button2Text = button2.GetComponentInChildren<Text>();
        button3Text = button3.GetComponentInChildren<Text>();
        button4Text = button4.GetComponentInChildren<Text>();
        questionText = GameObject.Find("QuestionText").GetComponent<Text>();
        questionNumberText = GameObject.Find("QuestionNumber").GetComponent<Text>();

        questionArray = GetComponent<TriviaReferences>().questionArray;
        correctAnswers = GetComponent<TriviaReferences>().correctAnswers;
        wrongAnswers1 = GetComponent<TriviaReferences>().wrongAnswers1;
        wrongAnswers2 = GetComponent<TriviaReferences>().wrongAnswers2;
        wrongAnswers3 = GetComponent<TriviaReferences>().wrongAnswers3;
        questionCount = questionArray.Length;

        //Starts the game
        StartGame();
    }
Esempio n. 2
0
 // Begin sets the reference to the references script
 void Begin()
 {
     refs = gameObject.GetComponent<TriviaReferences>();
     StartGame();
 }