Ejemplo 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;
            }
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (displayText && ((int)Time.time <= timer))
     {
         score     = sword.getScore();
         text.text = "Wave " + CW.ToString() + " complete\n" + "Next wave in " + (timer - (int)Time.time) + ".." + "\n\n" + "Score: " + score.ToString();
     }
     else
     {
         text.text   = null;
         displayText = false;
     }
 }