Skip to content

Instantly share code, notes, and snippets.

Created November 24, 2017 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8f3733f3347c2886929a8e54455740ec to your computer and use it in GitHub Desktop.
Save anonymous/8f3733f3347c2886929a8e54455740ec to your computer and use it in GitHub Desktop.
const string MASTER_VOLUME_KEY = "master_volume";
const string DIFFICULTY_KEY = "difficulty";
const string LEVEL_KEY = "level_unlocked_";
const string SURVIVAL_MODE_KEY = "survival_mode";
public static void SetMasterVolume (float volume){
if (volume >= 0f && volume <= 1f) {
PlayerPrefs.SetFloat (MASTER_VOLUME_KEY, volume);
} else {
Debug.LogError ("Master volume is out of range! Noooo!");
}
}
public static float GetMasterVolume() {
return PlayerPrefs.GetFloat (MASTER_VOLUME_KEY);
}
public static void SetSurvivalMode(float survival){
if (survival >= 0f && survival <= 1f) {
PlayerPrefs.SetFloat (SURVIVAL_MODE_KEY, survival);
} else {
Debug.LogError ("Survival mode is out of range!");
}
}
public static float GetSurvivalMode (){
return PlayerPrefs.GetFloat (SURVIVAL_MODE_KEY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment