/// <summary> /// Get list color from ArrayPrefs. /// </summary> /// <param name="t"></param> /// <returns></returns> public List <Color> GetColorList(PlayerPrefsKeys t) { Color[] arr = PlayerPrefsX.GetColorArray(t.ToString( )); List <Color> list = new List <Color>(); list.AddRange(arr); return(list); }
public void StartRace() { string key = PlayerPrefsKeys.GetTimeTrialHighscoreKey(SceneManager.GetActiveScene()); parkingSpot.OnPlayerParkingEnter.AddListener(FinishRace); stopwatch.Start(); running = true; }
public int this[int level, int status] { get { return(PlayerPrefs.GetInt(PlayerPrefsKeys.buildObjectiveStatusKey(level, status), 0)); } set { PlayerPrefs.SetInt(PlayerPrefsKeys.buildObjectiveStatusKey(level, status), value); } }
public int this[int level, int obj] { get { return(PlayerPrefs.GetInt(PlayerPrefsKeys.buildObjectiveKey(level, obj), 0)); } set { PlayerPrefs.SetInt(PlayerPrefsKeys.buildObjectiveKey(level, obj), value); } }
public static void Reset() { PlayerPrefs.SetInt(PlayerPrefsKeys.gameObjectivesIndex, 0); //here we consider 1 section and 6 objectives per section for (int lv = 0; lv < 1; lv++) { for (int obj = 1; obj <= 6; obj++) { PlayerPrefs.SetInt(PlayerPrefsKeys.buildObjectiveKey(lv, obj), 0); PlayerPrefs.SetInt(PlayerPrefsKeys.buildObjectiveStatusKey(lv, obj), 0); } } }
public void FinishRace() { Assert.IsTrue(running); running = false; long time = stopwatch.TimeElapsed; Debug.Log("Finished with a time of " + time + "ms."); string key = PlayerPrefsKeys.GetTimeTrialHighscoreKey(SceneManager.GetActiveScene()); if (PlayerPrefs.GetString(key).Length == 0) { PlayerPrefs.SetString(key, time.ToString()); } else if (time < long.Parse(PlayerPrefs.GetString(key))) { PlayerPrefs.SetString(key, time.ToString()); } OnFinish.Invoke(time); }
/// <summary> /// Set list color to ArrayPrefs. /// </summary> /// <param name="list"></param> /// <param name="t"></param> public void SetColorArr(List <Color> list, PlayerPrefsKeys t) { PlayerPrefsX.SetColorArray(t.ToString( ), list.ToArray( )); }