public void LoadData() { int cPumpkins = PrefsExtensions.LoadInt(m_dataKey.collectedPumpkinsKey); collectedPumpkins = cPumpkins; int dFloor = PrefsExtensions.LoadInt(m_dataKey.deepestFloorKey); deepestFloor = dFloor; int hp = PrefsExtensions.LoadInt(m_dataKey.healthKey); if (hp != 0) { m_Player.health = hp; } int pArmor = PrefsExtensions.LoadInt(m_dataKey.armorKey); m_Player.armor = pArmor; int pDmg = PrefsExtensions.LoadInt(m_dataKey.damageKey); m_Player.damage = pDmg; float spd = PlayerPrefs.GetFloat(m_dataKey.speedKey); m_Controller.movementSpeed = spd; }
private void AssignData() { m_deepestFloorText.text = "Deepest Floor :" + PrefsExtensions.LoadInt("High Score").ToString(); m_timesDiedText.text = "Times Died :" + PrefsExtensions.LoadInt("Times Died").ToString(); m_chestsOpenedText.text = "Chests Opened :" + PrefsExtensions.LoadInt("Chests Opened").ToString(); m_potionsConsumedText.text = "Potions consumed :" + PrefsExtensions.LoadInt("Potions Consumed").ToString(); m_pumpkinsPlacedText.text = "Pumpkins Planted :" + PrefsExtensions.LoadInt("Pumpkins Placed").ToString(); }
public void SaveData() { PrefsExtensions.SaveInt(m_dataKey.collectedPumpkinsKey, collectedPumpkins); PrefsExtensions.SaveInt(m_dataKey.deepestFloorKey, deepestFloor); PrefsExtensions.SaveInt(m_dataKey.healthKey, m_Player.health); PrefsExtensions.SaveInt(m_dataKey.armorKey, m_Player.armor); PrefsExtensions.SaveInt(m_dataKey.damageKey, m_Player.damage); PlayerPrefs.SetFloat(m_dataKey.speedKey, m_Controller.movementSpeed); }
private void ResetStats() { PrefsExtensions.SaveInt("High Score", 0); PrefsExtensions.SaveInt("Times Died", 0); PrefsExtensions.SaveInt("Chests Opened", 0); PrefsExtensions.SaveInt("Potions Consumed", 0); PrefsExtensions.SaveInt("Pumpkins Placed", 0); UnityEngine.Debug.Log("Data is gone !"); }
public void UpdateHighScore() { // We want to update player's high score when player gets better score. // Get the high score from player prefs first. int hScore = PrefsExtensions.LoadInt(m_dataKey.highScore); // Compare the high score with current floor deep. if (deepestFloor > hScore) { // We got a new high score here. // Update the high score. PrefsExtensions.SaveInt(m_dataKey.highScore, deepestFloor); } }
/// <summary> /// Detects the current system's resolution and sets it as game's resolution. /// </summary> public void AutoResolution() { Window wnd = new Window(); wnd.Width = Screen.currentResolution.width; wnd.Height = Screen.currentResolution.height; wnd.FullScreen = true; Screen.SetResolution(wnd.Width, wnd.Height, wnd.FullScreen); // Save resolution into player prefs. PrefsExtensions.SaveInt("Width", wnd.Width); PrefsExtensions.SaveInt("Height", wnd.Height); }
public void UpdatePumpkinsPlacedStatistic() { int pp = PrefsExtensions.LoadInt(m_dataKey.pumpkinsPlacedKey); PrefsExtensions.SaveInt(m_dataKey.pumpkinsPlacedKey, (pp + pumpkinsPlaced)); }
public void UpdatePotionsConsumedStatistic() { int pc = PrefsExtensions.LoadInt(m_dataKey.potionsConsumedKey); PrefsExtensions.SaveInt(m_dataKey.potionsConsumedKey, (pc + potionsConsumed)); }
public void UpdateChestStatistic() { int co = PrefsExtensions.LoadInt(m_dataKey.chestsOpenedKey); PrefsExtensions.SaveInt(m_dataKey.chestsOpenedKey, (co + chestsOpened)); }
public void UpdateDiedTimesStatistic() { int dt = PrefsExtensions.LoadInt(m_dataKey.timesDiedKey); PrefsExtensions.SaveInt(m_dataKey.timesDiedKey, (dt + 1)); }
/// <summary> /// Enables us to get height of screen. /// </summary> /// <returns> Height of screen. </returns> public static int GetHeight() { int h = PrefsExtensions.LoadInt("Height"); return(h); }
/// <summary> /// Enables us to get width of screen. /// </summary> /// <returns> Width of screen. </returns> public static int GetWidth() { int w = PrefsExtensions.LoadInt("Width"); return(w); }