Ejemplo n.º 1
0
    //


    // Start is called before the first frame update
    void Start()
    {
        //initialise fields
        currentWordIndex  = 0;
        wordText          = wordText.GetComponent <Text>();
        gameManager       = GameObject.FindGameObjectWithTag("GameManager");
        rewardScript      = gameManager.GetComponent <RewardScript>();
        buttonCanvasGroup = buttonCanvas.GetComponent <CanvasGroup>();
        reviewCanvasGroup = reviewPanel.GetComponent <CanvasGroup>();
        soundScript       = gameManager.GetComponent <PlaySoundScript>();

        //load word database xml & set array
        words = Words.Load(filePath);

        // Debug.Log(words.wordsArray.Length);

        wordsArray     = words.wordsArray;
        wordsArrayRand = new Word[gameLength];

        //pick random words
        ShuffleArray(wordsArray);


        //Debug.Log(wordsArrayRand[0].name);

        //Set text to current word
        wordText.text = wordsArrayRand[currentWordIndex].name;

        //Set Review Text
        SetReviewText();
    }
Ejemplo n.º 2
0
 void Awake()
 {
     // Register the singleton
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of PlaySoundScript!");
     }
     Instance = this;
     DontDestroyOnLoad(transform.gameObject);
 }