Example #1
0
    IEnumerator Init()
    {
        while (ansCards.fLoaded == false)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        ansCards.loadCardList("Cards");
        cardCount = ansCards.cardList.Count;
        if (cardCount == 0)
        {
            Debug.Log("No configuration available for selected option");
        }
        else
        {
            uiTxtLevelName.text = globalData.path [globalData.pathDepth];
            urTestCard          = new uniqueRand(0, cardCount - 1);
            testScore.resetScore();
            ansCardSo [0].GetComponent <ansCardGo> ().init(0);
            ansCardSo [1].GetComponent <ansCardGo> ().init(1);
            ansCardSo [2].GetComponent <ansCardGo> ().init(2);
            ansCardSo [3].GetComponent <ansCardGo> ().init(3);

            showNextCard();
        }
    }
    private void randomizeArray()
    {
        rIndexArray = new int[cardCount];
        uniqueRand r = new uniqueRand(0, cardCount - 1);

        r.resetUniqueRandomInt();

        for (int i = 0; i < cardCount; i++)
        {
            rIndexArray[i] = r.nextRandom();
        }
    }
Example #3
0
    IEnumerator Init()
    {
        while (flashCards.fLoaded == false)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        flashCards.loadCardList("Cards");
        cardCount = flashCards.cardList.Count;
        if (cardCount == 0)
        {
            Debug.Log("No configuration available for selected option");
            yield break;
        }

        rIndexArray = new int[cardCount];
        //Order in which to show the cards


        //if shuffle flag is set, the array is set in a random order
        if (flashCards.fShuffle)
        {
            uniqueRand r = new uniqueRand(0, cardCount - 1);
            r.resetUniqueRandomInt();
            for (int i = 0; i < cardCount; i++)
            {
                rIndexArray [i] = r.nextRandom();
            }
        }
        else
        {
            //if shuffle flag is not set, the array is set in a sequential order
            for (int i = 0; i < cardCount; i++)
            {
                rIndexArray [i] = i;
            }
        }

        fc1 = (GameObject)Instantiate(cubeFlashCard, fcPlaceHolder1.transform.position, fcPlaceHolder1.transform.rotation);
        fc2 = (GameObject)Instantiate(cubeFlashCard, fcPlaceHolder2.transform.position, fcPlaceHolder2.transform.rotation);
        fc3 = (GameObject)Instantiate(cubeFlashCard, fcPlaceHolder3.transform.position, fcPlaceHolder3.transform.rotation);

        fc1.GetComponent <showFlashCard> ().show(rIndexArray [0]);
        fc2.GetComponent <showFlashCard> ().show(rIndexArray [1]);
        fc3.GetComponent <showFlashCard> ().show(rIndexArray [2]);
        topCard = 0;
    }
Example #4
0
    void showAnswers()
    {
        int        randomAnsCard;
        int        randomPos;
        int        fillCount = 0;
        uniqueRand urPosCard = new uniqueRand(0, 3);
        uniqueRand urAnsCard = new uniqueRand(0, cardCount - 1);

        randomPos = urPosCard.nextRandom();
        ansCardSo [randomPos].GetComponent <ansCardGo> ().show(selectedCard);
        fillCount = fillCount + 1;

        while (fillCount < 4)
        {
            randomAnsCard = urAnsCard.nextRandom();
            if (randomAnsCard != selectedCard)
            {
                randomPos = urPosCard.nextRandom();
                ansCardSo [randomPos].GetComponent <ansCardGo> ().show(randomAnsCard);
                fillCount = fillCount + 1;
            }
        }
    }
Example #5
0
    void showGame()
    {
        uniqueRand urTerm = new uniqueRand(0, cardCount - 1);
        int        randomTerm;

        uniqueRand urCardPos = new uniqueRand(0, 11);
        int        randomPos;

        createCards();
        clickNo      = 0;
        cardsMatched = 0;

        for (int i = 0; i < 6; i++)
        {
            randomTerm = urTerm.nextRandom();

            randomPos = urCardPos.nextRandom();
            matchCardsGo [randomPos].GetComponent <matchCardGo> ().show(randomTerm, "IMAGE");

            randomPos = urCardPos.nextRandom();
            matchCardsGo [randomPos].GetComponent <matchCardGo> ().show(randomTerm, "TEXT");
        }
    }