-
Notifications
You must be signed in to change notification settings - Fork 0
/
PrefsManager.cs
43 lines (33 loc) · 986 Bytes
/
PrefsManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class PrefsManager {
const string MUSIC_VOLUME = "musicVolume";
const string SFX_VOLUME = "sfxVolume";
const string HIGH_SCORE = "highScore";
const string HAS_SET_VOLUME = "hasSetVolume";
public static int GetHasSetVolume() {
return PlayerPrefs.GetInt (HAS_SET_VOLUME);
}
public static float GetMusicVolume() {
return PlayerPrefs.GetFloat (MUSIC_VOLUME);
}
public static void SetMusicVolume(float volume){
PlayerPrefs.SetFloat (MUSIC_VOLUME, volume);
}
public static float GetSFXVolume() {
return PlayerPrefs.GetFloat (SFX_VOLUME);
}
public static void SetSFXVolume(float volume) {
PlayerPrefs.SetFloat (SFX_VOLUME, volume);
}
public static int GetHighScore() {
return PlayerPrefs.GetInt (HIGH_SCORE);
}
public static void SetHighScore(int score) {
PlayerPrefs.SetInt (HIGH_SCORE, score);
}
public static void Save() {
PlayerPrefs.Save ();
}
}