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); } }
private void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); }
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(); }
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; }
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(); }
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); } } }
//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; } }
public TopScoreTracker(HighScoreTracker scoreTracker) { listOfScores = scoreTracker.getHighScoreList(); }