Ejemplo n.º 1
0
 public HighScores()
 {
     Entries = new HighScoresEntry[3];
     for (int i = 0; i < 3; ++i)
     {
         Entries[i] = new HighScoresEntry();
     }
 }
Ejemplo n.º 2
0
    private void OnDestroy()
    {
        HighScores highScores = HighScores.LoadHighScores();

        if (NewHighScoreGameObject.activeSelf)
        {
            HighScoresEntry newEntry = new HighScoresEntry
            {
                EngineerName = EngineerNameText.text,
                GunnerName   = GunnerNameText.text,
                RunnerName   = RunnerNameText.text,
                TeamScore    = Scoring.TeamScore
            };
            highScores.Insert(newEntry);
            HighScores.SaveHighScores(highScores);
        }
    }
Ejemplo n.º 3
0
 public bool Insert(HighScoresEntry newEntry)
 {
     if (newEntry.TeamScore > Entries[2].TeamScore)
     {
         // insert high score
         Entries[2] = newEntry;
         int i = 1;
         while (i >= 0 && Entries[i].TeamScore < Entries[i + 1].TeamScore)
         {
             HighScoresEntry tmp = Entries[i];
             Entries[i]     = Entries[i + 1];
             Entries[i + 1] = tmp;
             i--;
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 private void Start()
 {
     Entry = new HighScoresEntry();
 }