private void Awake()
    {
        m_highScoreTracker         = new HighScoreTracker();
        m_highScoreTracker.CanSave = true;

        // Initialize our HighScores List to 0
        for (int i = 0; i < m_maxNumOfScores; i++)
        {
            HighScores.Add(0);
        }
    }
Example #2
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
            return;
        }

        instance = this;

        DontDestroyOnLoad(gameObject);
    }
Example #3
0
    public static void SaveScoreList(HighScoreTracker scoreTracker)
    {
        BinaryFormatter formatter = new BinaryFormatter();

        string path = Application.persistentDataPath + "/score.lol";

        FileStream stream = new FileStream(path, FileMode.Create);

        TopScoreTracker topScoreTracker = new TopScoreTracker(scoreTracker);

        formatter.Serialize(stream, topScoreTracker);
        stream.Close();
    }
Example #4
0
    void Awake()
    {
        if (highScoreTracker == null)
        {
            DontDestroyOnLoad(gameObject);
            highScoreTracker = this;
        }

        else if (highScoreTracker != this)
        {
            Destroy(gameObject);
        }
    }
    private void OnEnable()
    {
        if (Instance != null)
        {
            Debug.LogError("HighScoreTracker: There should never more than one instance of HighScoreTracker");
        }

        Instance = this;

        DontDestroyOnLoad(HighScoreCanvas);
        DontDestroyOnLoad(HighScoreTrackerGO);
        UpdateHighScoreVisuals();
        NewHighScore.GetComponent <CanvasGroup>().alpha = 0.0f;
    }
Example #6
0
        public void EndGameNormally()
        {
            GameUI.Close();
            PlayerManager.CalculateScore();
            HighScore newHighScore = new HighScore(Name, CaveNumber, PlayerManager.Score);

            HighScoreTracker.WriteNewScore(newHighScore);

            GameEndForm CreditsForm = new GameEndForm();

            CreditsForm.PlayerObject = PlayerManager;
            CreditsForm.PlayerName   = Name;
            CreditsForm.ShowDialog();
        }
Example #7
0
    public void Start()
    {
        highScoreTracker = this;

        highScoreText = GetComponent <Text>();

        TopScoreTracker topScoreTracker = ScoreSaveSystem.LoadScoreList();

        if (topScoreTracker != null)
        {
            highScoreList = topScoreTracker.listOfScores;
        }
        else
        {
            highScoreList = new List <int>();

            for (int i = 0; i < 5; i++)
            {
                highScoreList.Add(0);
            }
        }
    }
Example #8
0
    //private Slider shieldSlider;

    //private ShieldController shieldController;

    //private bool shielded;

    //private bool recharging;
    #endregion Old Shield Stuff

    // Start called before the first frame update
    void Awake()
    {
        currentHP     = maxHP;
        currentShield = maxShield;

        hpUIController = GameObject.Find("Health Bar").GetComponent <HpBar>();

        shake = Camera.main.GetComponent <ScreenShake>();

        sprite = GetComponent <SpriteRenderer>();

        shipCollidier = GetComponent <Collider2D>();

        shipMovement = GetComponentInParent <ShipMovement>();

        particle = GetComponentInParent <ParticleSystem>();

        invincible      = false;
        invincibleTimer = setInvincibleTimer;

        gameOverPrompt.SetActive(false);
        uiBar.SetActive(true);

        audioSource = GetComponent <AudioSource>();

        highScoreTracker = GameObject.Find("Hi-Score").GetComponent <HighScoreTracker>();

        #region Old Shield Stuff
        //shieldSlider = GameObject.Find("Shield Bar").GetComponent<Slider>();

        //shieldController = GetComponentInParent<ShieldController>();

        //shieldSlider.maxValue = maxShield;
        //shieldSlider.value = currentShield;

        //shielded = false;
        //recharging = false;
        #endregion Old Shield Stuff
    }
    private void Awake()
    {
        if (S == null)
        {
            S = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        m_highScores       = new List <int>();
        m_highScoreTracker = new HighScoreTracker
        {
            CanSave = true
        };

        // Validate Countdown Length
        if (m_countdownLength < 3f)
        {
            m_countdownLength = 3f;
        }
    }
Example #10
0
 public TopScoreTracker(HighScoreTracker scoreTracker)
 {
     listOfScores = scoreTracker.getHighScoreList();
 }