Exemple #1
0
    void Awake()
    {
        int[] check = new int[46];
        int   randomNumber;
        int   loopCount = 0;

        while (hiraganaNumStack.Count < 46)
        {
            randomNumber = Random.Range(0, hiragana.Length);
            bool flag = true;

            if (check[randomNumber] != 0)
            {
                flag = false;
            }

            if (flag == true)
            {
                hiraganaNumStack.Push(randomNumber);
                //Debug.Log (randomNumber + " selected.");
                check[randomNumber] = -1;
            }

            /*else
             *      Debug.Log ("DENIED!");*/

            loopCount++;
        }

        Debug.Log("pre-selection of integers done! " + loopCount + " loop throughs.");

        countUsedHiragana = 0;
        inUseRound        = new int[3];
        usedHiragana      = new int[hiragana.Length];    // Initializes to number of hiragana (will always be 46).
        //Debug.Log ("[GC_Awake] hiragana.Length = " + hiragana.Length);
        GMAudioSource = gameObject.GetComponent <AudioSource>();

        timer     = Timer.FindObjectOfType(typeof(Timer)) as Timer;
        gameSetup = GameSetup.FindObjectOfType(typeof(GameSetup)) as GameSetup;
        shake     = CameraShake.FindObjectOfType(typeof(CameraShake)) as CameraShake;
        flash     = RedFlash.FindObjectOfType(typeof(RedFlash)) as RedFlash;

        InstantiateRound();
    }