public void UpdateState() { var start = DateTime.Now; if (_workers.Workers.Count() == 0) { UpdateWorkerInformation(); } InboxStoryCount = _board.InboxStoryCount; BacklogStoryCount = _board.BacklogStoryCount; DevStoryCount = _board.DevStoryCount; TestStoryCount = _board.TestStoryCount; DoneStoryCount = _board.DoneStoryCount; Debug.WriteLine($"Story count in: {DateTime.Now.Subtract(start).TotalMilliseconds})"); start = DateTime.Now; FounderFree = _workers.Workers.Where(w => w.Id == "p1").FirstOrDefault()?.isFree ?? false; Debug.WriteLine($"Founder Free in: {DateTime.Now.Subtract(start).TotalMilliseconds})"); start = DateTime.Now; DevsFree = _workers.IdleWorkerCount(WorkerTypes.dev); TestersFree = _workers.IdleWorkerCount(WorkerTypes.test); BasFree = _workers.IdleWorkerCount(WorkerTypes.ba); Debug.WriteLine($"idle count in: {DateTime.Now.Subtract(start).TotalMilliseconds})"); start = DateTime.Now; Bank = _store.TotalMoneyAvailable; NewProjectCost = _store.NewProjectCost; Debug.WriteLine($"Bank and Project Cost in: {DateTime.Now.Subtract(start).TotalMilliseconds})"); if (DevUpgradeCost == int.MaxValue || TestUpgradeCost == int.MaxValue || BaUpgradeCost == int.MaxValue) { UpdateWorkerUpgradeCost(); } if (DevHireCost == int.MaxValue || TestHireCost == int.MaxValue || BaHireCost == int.MaxValue) { UpdateWorkerHireCost(); } CanHireDev = DevHireCost < Bank; CanHireTest = TestHireCost < Bank; CanHireBa = BaHireCost < Bank; CanUpgradeDev = _devUpgradeEnabled && DevUpgradeCost < Bank; CanUpgradeTest = _testUpgradeEnabled && TestUpgradeCost < Bank; CanUpgradeBa = _baUpgradeEnabled && BaUpgradeCost < Bank; if (!_devUpgradeEnabled) { _devUpgradeEnabled = _store.IsStoreItemAvailable(WorkerTypes.dev); } if (!_testUpgradeEnabled) { _testUpgradeEnabled = _store.IsStoreItemAvailable(WorkerTypes.test); } if (!_baUpgradeEnabled) { _baUpgradeEnabled = _store.IsStoreItemAvailable(WorkerTypes.ba); } loopCount++; }