public override void Update() { if (frameTime < 1.13f) { frameTime += Time.deltaTime; return; } frameTime = 0; foreach (var x in Achievements) { if (x.IsCompleted) { continue; } if (Services.TransportService.HasUnits(x.TargetGeneratorId)) { var tCount = Services.TransportService.GetUnitTotalCount(x.TargetGeneratorId); //_pdata.OwnedGenerators[x.TargetGeneratorId]; if (tCount >= x.TargetCount) { Services.GetService <IAchievmentServcie>().AddCompletedAchievment(x.Id.ToString()); Services.AchievmentService.AddAchievmentPoints(x.Points); Points += x.Points; x.IsCompleted = true; switch (x.RewardType) { case RewardType.SpeedUpgrade: //Services.GenerationService.Generators.ApplyTime(x.TargetGeneratorId, x.RewardValue); Services.GenerationService.Generators.AddTimeBoost(x.TargetGeneratorId, BoostInfo.CreateTemp(BosUtils.PrefixedId("speed_achiv_"), x.RewardValue)); break; case RewardType.ProfitUpgrade: Services.GenerationService.Generators.AddProfitBoost(x.TargetGeneratorId, BoostInfo.CreateTemp(BosUtils.PrefixedId("profit_achiv_"), x.RewardValue)); //Services.GenerationService.Generators.ApplyProfit(x.TargetGeneratorId, ProfitMultInfo.Create(x.RewardValue)); break; default: break; } //Proc.Invoke(x); GameEvents.OnAchievmentCompleted(new AchievmentInfo(x.Id, x.Name)); StatsCollector.Instance[Stats.REWARDS_UNLOCKED]++; ChangeGeneratorIcon(x); Player.LegacyPlayerData.Save(); } } } }