コード例 #1
0
ファイル: Wallet.cs プロジェクト: jirehcwe/Currency-Exchange
    public void createNoteInWalletRiels(ProblemAndAnswer answer)
    {
        maxAddUsdNum   = settings.MaxAddUsdNum;
        maxAddReilsNum = settings.MaxAddRielsNum;
        minAddUsdNum   = 0;
        minAddReilsNum = settings.MinAddRielsNum;
        List <Note> notesToDisplay = addRandomNote(answer.GetRielAnswer(), 0, maxAddReilsNum);

        foreach (Note note in notesToDisplay)
        {
            // Debug.Log("Note passed: " + note);
            createNote(note);
        }

        // for (int i=0; i<answer.GetRielAnswer().Count;i++){
        //     createNote(testNote);
        // }
    }
コード例 #2
0
    //OLD CODE -> CONSIDER DELETING

    /* float createNewBasket()
     * {
     *   for (int i=0; i< groceryItems.Count; i++){
     *       Destroy(groceryItems[i]);
     *   }
     *   groceryItems.Clear();
     *   itemCount = 0;
     *   totalCost = 0;
     *   for(int i = 0; i < 5; i++)
     *   {
     *       if (itemCount >= maxItems) break;
     *       randNum = Random.Range(0, 2);
     *       for (int j = 0; j < randNum; j++)
     *       {
     *           if (itemCount >= maxItems) break;
     *           groceryItems.Add(Instantiate(prefabs[i]) as GameObject);
     *           groceryItems[groceryItems.Count - 1].transform.SetParent(groceryBasket.transform, false);
     *           groceryItems[groceryItems.Count - 1].transform.localPosition = new Vector3(xDisplace, 0, 0);
     *           groceryItems[groceryItems.Count - 1].transform.localPosition += new Vector3(xSpacing*itemCount, 0, 0);
     *           groceryItems[groceryItems.Count - 1].transform.localScale = new Vector3(1, 1, 1);
     *           itemCount++;
     *           totalCost += itemCost[i];
     *       }
     *
     *
     *   }
     *
     *   return totalCost;
     *
     * }*/

    public void GenerateNewProblem()
    {
        float problemValue = 100 * Random.Range((int)GameManager.instance.currentProblemMinInRiels / 100, (int)GameManager.instance.currentProblemLimitInRiels / 100);

        newProblem     = new ProblemAndAnswer(problemValue);
        requiredAmount = newProblem.GetUSDSum();
        basketMgr.nextBasket(newProblem.GetRielSum());
        // Debug.Log("generated new problem");
        List <Note> display = newProblem.GetRielAnswer();

        // for (int i = 0; i < display.Count; i++)
        // {
        //     Debug.Log("Notes passed: " + display[i].name);
        // }
        //  ///wallet.createNoteInWalletRiels(newProblem);
        if (settings.mixedToggle)
        {
            wallet.createNoteInWalletMixed(newProblem);
        }
        else
        {
            wallet.createNoteInWalletRiels(newProblem);
        }
    }
コード例 #3
0
ファイル: Wallet.cs プロジェクト: jirehcwe/Currency-Exchange
    public void createNoteInWallet(ProblemAndAnswer answer)    //This is the main function that will be used
    {
        List <Note> notesToDisplay = addRandomNote(mergeAnswers(answer.GetMixedAnswer(), answer.GetRielAnswer()), maxAddUsdNum, maxAddReilsNum);

        for (int i = 0; i < notesToDisplay.Count; i++)
        {
            createNote(notesToDisplay[i]);
        }
    }