Ejemplo n.º 1
0
    /**
     * This method will request player performances on each; addition, substraction and multiplication
     * then will create set of array Operators based on the plyer perfomance
     * */
    public void UpdateOperators()
    {
        //player1Name = PlayerPrefs.GetString("player1Name");
        string addition       = webRequests.GetAdditionPerformance("Omar");
        string substraction   = webRequests.GetSubstractionPerformance("Omar");
        string multiplication = webRequests.GetMultiplicationPerformance("Omar");

        print("Addition result" + addition);

        //asign values of performances



        //calculate avergae perfoamances
        int additionAvg       = int.Parse(addition) + int.Parse(substraction) + int.Parse(multiplication) / int.Parse(addition);
        int substractionAvg   = int.Parse(addition) + int.Parse(substraction) + int.Parse(multiplication) / int.Parse(substraction);
        int multiplicationAvg = int.Parse(addition) + int.Parse(substraction) + int.Parse(multiplication) / int.Parse(multiplication);

        //set up value of Addition operators
        if (additionAvg > 5)
        {
            additionPerformance = 1;
        }
        else if (additionAvg < 5 && additionAvg > 10)
        {
            additionPerformance = 2;
        }
        else if (additionAvg < 10 && additionAvg > 21)
        {
            additionPerformance = 3;
        }
        else
        {
            additionPerformance = 3;
        }

        //set up value of substraction operators
        if (substractionAvg > 5)
        {
            substractionPerformance = 1;
        }
        else if (substractionAvg < 5 && substractionAvg > 10)
        {
            substractionPerformance = 2;
        }
        else if (substractionAvg < 10 && substractionAvg > 21)
        {
            substractionPerformance = 3;
        }
        else
        {
            substractionPerformance = 3;
        }

        //set up multiplictions operator value
        if (multiplicationAvg > 5)
        {
            multiplicationPerformance = 1;
        }
        else if (multiplicationAvg < 5 && multiplicationAvg > 10)
        {
            multiplicationPerformance = 2;
        }
        else if (multiplicationAvg < 10 && multiplicationAvg > 21)
        {
            multiplicationPerformance = 3;
        }
        else
        {
            multiplicationPerformance = 3;
        }

        CreateOperatorsArray();
    }