コード例 #1
0
 public HighScoresViewModel(IMessenger messenger)
 {
     this.messenger = messenger;
     messenger.Register<HighScoresUpdateMessage>(this, (msg) => UpdateHighScores());
     scoreStorage = new ScoreStorage();
     m_highScores = new ObservableCollection<Score>(scoreStorage.GetScores());
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: spixy/Hungry-Dyno
    private void Awake()
    {
        Instance = this;

        spawnersStopped = false;
        Score           = 0;
        State           = State.MainMenu;
        scoreStorage    = new ScoreStorage();

        soundtrack.Play();
    }
コード例 #3
0
 private void Awake()
 {
     if (!instance)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #4
0
    //Score change if win or lose
    public void OnHighScore()
    {
        ScoreStorage ScoreCheck = JsonUtility.FromJson <ScoreStorage>(jsonString);

        ScoreCheck.scoreList.Add(overall);
        ScoreCheck.scoreList = ScoreCheck.scoreList.OrderByDescending(x => x).ToList();

        for (int i = 0; i < highestScoreText.Count; i++)
        {
            highestScoreText[i].text = ScoreCheck.scoreList[i].ToString();
        }

        Debug.Log("Saved JSON string: " + JsonUtility.ToJson(ScoreCheck));

        File.WriteAllText(path, JsonUtility.ToJson(ScoreCheck));
    }