예제 #1
0
 //Static load method, can be called from any class "DataManager.LoadData();"
 public static void LoadData()
 {
     object[] obj = dataSaver.Load();  //Get the data array from the file
     //We assign the objects we need
     if (obj != null)
     {
         data        = obj[0] as Data;
         upgradeData = obj[1] as UpgradeData;
     }
 }
예제 #2
0
        void Init()
        {
            //Create an instance of classes
            data        = new Data();
            upgradeData = new UpgradeData();

            //Cached component from our Gameobject
            dataSaver = GetComponent <DataSaver>();

            LoadData();

            //We make the first launch, and give the starter kit
            if (!data.isFirstStartComplete)
            {
                data.isFirstStartComplete = true;

                data.Money        = 100;
                data.MoneyByClick = 1;

                SaveData();
            }
        }