Beispiel #1
0
 public static List <Score> GetScores()
 {
     if (!Instance)
     {
         Instance = FindObjectOfType <GreatestGoblins>();
     }
     return(Instance.HighScores);
 }
Beispiel #2
0
    void Awake()
    {
        if (!Instance)
        {
            Instance = this;
        }

        SaveControls = FindObjectOfType <SaveController>();
    }
Beispiel #3
0
 public void SaveHighscores()
 {
     SaveGame.Save(
         highscoreIdentifier, GreatestGoblins.GetScores(),
         encode,
         encodePassword,
         serializer,
         encoder,
         encoding,
         savePath
         );
 }
Beispiel #4
0
    internal static void SetScores(List <Score> list)
    {
        if (list == null || !list.Any())
        {
            return;
        }


        if (!Instance)
        {
            Instance = FindObjectOfType <GreatestGoblins>();
        }

        Instance.HighScores = list.Take(10).ToList();
    }
Beispiel #5
0
 /// <summary>
 /// Load this instance.
 /// </summary>
 public virtual void Load()
 {
     if (saveHighscores)
     {
         if (SaveGame.Exists(highscoreIdentifier))
         {
             GreatestGoblins.SetScores(SaveGame.Load <List <GreatestGoblins.Score> > (
                                           highscoreIdentifier
                                           ));
         }
     }
     if (saveLegacy)
     {
         if (SaveGame.Exists(legacyIdentifier))
         {
             LegacySystem.SetAchievements(SaveGame.Load <List <LegacySystem.Achievement> >(legacyIdentifier));
         }
     }
 }
Beispiel #6
0
    public IEnumerator FadeToHighScoreRoutine()
    {
        var start    = Time.time;
        var duration = 4f;
        var end      = start + duration;

        var endColor   = BlackscreenImage.color;
        var startColor = new Color(0, 0, 0, 0);

        BlackscreenImage.gameObject.SetActive(true);

        while (Time.time < end)
        {
            BlackscreenImage.color = Color.Lerp(startColor, endColor, (Time.time - start) / duration);
            yield return(new WaitForFixedUpdate());
        }

        GreatestGoblins.ShowHighscores();
        //TODO: move to above method
        HighScoreScreen.gameObject.SetActive(true);
    }