public void UpgradeMage() { if (Player.Data.GetCurrency() < Data.GetUpgradePrice()) { return; } Player.DecreaseCurrency(Data.GetUpgradePrice()); Data.UpgradeMage(); switch (Data.GetElement()) { case Element.Air: Player.AchievementManager.RegisterEvent(AchievementType.AirMage, Data.GetLevel() + 1); break; case Element.Fire: Player.AchievementManager.RegisterEvent(AchievementType.FireMage, Data.GetLevel() + 1); break; case Element.Earth: Player.AchievementManager.RegisterEvent(AchievementType.EarthMage, Data.GetLevel() + 1); break; case Element.Water: Player.AchievementManager.RegisterEvent(AchievementType.WaterMage, Data.GetLevel() + 1); break; default: break; } //Do not spam with events if ((Data.GetLevel() < 50 && Data.GetLevel() % 10 == 0) || Data.GetLevel() % 5 == 0) { AnalyticsManager.MageUpgraded(this); } if (_building != null) { _building.DisplayRangeObject(); _building.StartHighlighting(); } }