// Start is called before the first frame update void Start() { List <HighScore> highscores = HighscoresManager.Load(); if (highscores != null) { foreach (HighScore score in highscores) { GameObject ui = Instantiate(prefabHighscoreUI, gameObject.transform); HighScoreUI uiCode = ui.GetComponent <HighScoreUI>(); if (uiCode != null) { uiCode.SetupUI(score); } } } else { GameObject ui = Instantiate(prefabHighscoreUI, gameObject.transform); HighScoreUI uiCode = ui.GetComponent <HighScoreUI>(); if (uiCode != null) { uiCode.SetupWithoutHighScore("No Highscores"); } } }
public void StoreScore() { GameManager gmc = FindObjectOfType <GameManager>(); string name = gmc.getPlayerName(); int score = CalculateScore(); HighScore highscore = new HighScore(name, score); HighscoresManager.Save(highscore); Debug.Log(name + " got score: " + score); }
void KO() { if (!defeated) { defeated = true; LoadBattleSceneScript loadBattleSceneScript = FindObjectOfType <LoadBattleSceneScript>(); GameJolt.API.Scores.Add( new Score((int)Time.timeSinceLevelLoad, Time.timeSinceLevelLoad.ToString(), "Someone w/ " + SystemInfo.deviceModel), HighscoresManager.GetHighscoresIndex(loadBattleSceneScript.EnemyType, loadBattleSceneScript.EnemyLevel), isSuccess => Debug.Log("Highscores update success=" + isSuccess)); EventMessanger.GetInstance().TriggerEvent(new PlayerVictoryEvent()); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); LoadGameData(); }
// Start is called before the first frame update void Start() { text = GetComponent <Text>(); gmc = FindObjectOfType <GameManager>(); List <HighScore> listScore = HighscoresManager.Load(); string txt = ""; if (listScore != null) { HighScore best = listScore[0]; txt = best.getName() + " got " + best.getScore(); } else { txt = "You have not played the game yet!"; } text.text = txt; }
private void Awake() { _manager = FindObjectOfType <HighscoresManager>(); highscores = _manager.GetHighscores(); }
private void Awake() { _waves = FindObjectOfType <WaveManager>(); _highscores = GetComponent <HighscoresManager>(); }