Created
July 4, 2016 21:48
-
-
Save Magnagames/1aa8ddfe7583900ed1a26c944aecd0d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class GameData : SingletonMonoBehaviour<GameData>{ | |
//セーブしたいデータを定義するクラス | |
//コンストラクタで値を初期化 | |
class SaveData: SavableSingleton<SaveData>{ | |
public Player Player; | |
public float VolumeSE; | |
public float VolumeBGM; | |
public SaveData(){ | |
Player = new Player(); | |
VolumeSE=0.5f; | |
VolumeBGM=0.5f; | |
} | |
} | |
public static void Save(){ | |
SaveData.Save (); | |
} | |
public static void Reset(){ | |
SaveData.Reset (); | |
} | |
public static float VolumeSE{ | |
get{return SaveData.Instance.VolumeSE;} | |
set{SaveData.Instance.VolumeSE = value; } | |
} | |
public static float VolumeBGM{ | |
get{return SaveData.Instance.VolumeBGM;} | |
set{SaveData.Instance.VolumeBGM = value; } | |
} | |
public static Player Player{ | |
get{return SaveData.Instance.Player;} | |
set{ SaveData.Instance.Player = value; } | |
} | |
public void Awake() | |
{ | |
if(this != Instance) | |
{ | |
Destroy(this); | |
return; | |
} | |
DontDestroyOnLoad(this.gameObject); | |
} | |
void Start(){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment