void Awake() { if (ID == 0) { Debug.LogError("WARNING: THE ID of Upgrade Cannot be 0"); } if (LastTouchedID == 0) { BuyButton.gameObject.SetActive(false); CostText.text = ""; DetailsText.text = ""; } Saver = new eSave(); if (Saver.isSaved(ID.ToString())) { Level = Saver.LoadInt(ID.ToString()); } Costs = new decimal[Cost.Length]; for (int i = 0; i < Costs.Length; i++) { Costs[i] = System.Convert.ToDecimal(Cost[i]); } IdleEngineMain.OnSave += Save; GeneratedLevels = Saver.LoadInt(ID.ToString() + "TotalNew"); if (Level == MaxLevel) { Destroy(gameObject); } LastTouchedID = 0; }
void Load() { eSave loader = new eSave(); if (loader.isSaved("MaxLevel")) { if (OnLoad != null) { OnLoad(); } DateTime LastPlayDay = loader.LoadDateTime("LastPlayTime"); Money = loader.LoadDecimal("Money"); MoneyMultiplier = loader.LoadDecimal("MoneyM"); Score = loader.LoadDecimal("Score"); TapPerSec = loader.LoadFloat("TPS"); IdleMoneyPerSec = loader.LoadDecimal("IdleMoney"); DamageMultiplier = loader.LoadDecimal("DamageM"); CurrentItem = loader.LoadInt("CurItem"); Damage = loader.LoadDecimal("Damage"); MaxLevelUnlocked = (loader.LoadInt("MaxLevel")); if (PlayerPrefs.GetInt("GI") > 0) { MaxLevelUnlocked = Items.Length - 1; } TimeSpan TotalTime = DateTime.Now - LastPlayDay; TotalSec = (decimal)TotalTime.TotalSeconds; MoneyGot = (TotalSec * IdleMoneyPerSec * util.ConvertToDecimal(Items[CurrentItem].RewardPrice) / 2); Money += MoneyGot;; if (MoneyGot > 0.000001m) { MoneyGotText.text = BigNumber.ShortNumber(MoneyGot); } } }
void Start() { saver = new eSave(); if (saver.isSaved("Gems")) { Gems = saver.LoadInt("Gems"); GemChances = saver.LoadInt("GeC"); } IdleItem.OnDeath += GemLuck; IdleEngineMain.OnSave += Save; }