Esempio n. 1
0
    void calculateHighScore()
    {
        int score = sword.getScore();

        print("score set");
        for (int i = 0; i < 10; i++)
        {
            print("current lap " + i);
            print(HS.GetValue(i));

            if (score > ((HighScoreStruct)HS.GetValue(i)).getScore()) //check if current score is higher than the old score
            {
                scoreChanged      = true;
                activateTextField = true;
                //while (!submittedText) { }
                HighScoreStruct temp = new HighScoreStruct(stringToEdit, score);
                print("created new highscorestruct");
                HighScoreStruct temp2 = (HighScoreStruct)HS.GetValue(i);
                HS.SetValue(temp, i);

                for (int y = i + 1; y < 10; y++)
                {
                    temp = (HighScoreStruct)HS.GetValue(y);
                    HS.SetValue(temp2, y);
                    temp2 = temp;
                }
                i = 10;
            }
        }
    }