コード例 #1
0
    // 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");
            }
        }
    }
コード例 #2
0
ファイル: Tracker.cs プロジェクト: TimeglitchD/GLAZE_AVB
    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);
    }
コード例 #3
0
 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());
     }
 }
コード例 #4
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        LoadGameData();
    }
コード例 #5
0
    // 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;
    }
コード例 #6
0
 private void Awake()
 {
     _manager   = FindObjectOfType <HighscoresManager>();
     highscores = _manager.GetHighscores();
 }
コード例 #7
0
 private void Awake()
 {
     _waves      = FindObjectOfType <WaveManager>();
     _highscores = GetComponent <HighscoresManager>();
 }