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)); }