private void InhabitantsCallback(object state) { var totalInhabitants = _workerService.TotalInhabitants(); var diff = (NumberOfBuildings * _numberOfInhabitantsPerHouse) - totalInhabitants; if (diff > 0) { var rand = new Random(); var inhabitantsToAdd = rand.Next(2, 5); inhabitantsToAdd = inhabitantsToAdd > diff ? diff : inhabitantsToAdd; for (int i = 0; i < inhabitantsToAdd; i++) { _workerService.AddPersonToWorker(typeof(IdleWorker)); } _storyService.Invoke($"A new Family of {inhabitantsToAdd} took refuge in your town!"); if (!_townHall.IsUnlocked) { for (int i = 0; i < inhabitantsToAdd - 1; i++) { _workerService.AddPersonToWorker(typeof(WoodGatherer)); } _storyService.Invoke($"A few of them became Wood Gatherers"); } } }
private void HandleStory() { // Big bad switch // Replace with something else at a later stage... switch (_progression) { case EStoryProgression.LookAround: { AddOutput(@"you look around"); break; } case EStoryProgression.FindWood: { AddOutput(@"you search the field for branches. you found something you can burn"); _resourceService.AddToResource(EResourceType.Wood, 10); _resourceService.EnableResource(EResourceType.Wood); break; } case EStoryProgression.FireInitial: { AddOutput(@"you start to light the fire"); AddOutput(@"the fire starts to burn"); _resourceService.SubtractFromResource(EResourceType.Wood, 5); break; } case EStoryProgression.FireLit: { AddOutput(@"the area is still cold"); break; } case EStoryProgression.FireCold: { AddOutput(@"the fire keeps burning"); Timer timer = new Timer((_) => { AddOutput(@"a strange shivering creature joins you next to the fire"); AddOutput(@"you look past the creature and see a forest..."); _visibilityService.Unlock(EMenuType.Woods); _resourceService.EnableResource(EResourceType.Food); }, null, 7_500 / _state.HyperState.DivideBy, -1); break; } case EStoryProgression.FireWarm: { AddOutput(@"the area is getting warmer"); break; } case EStoryProgression.FireWarmer: { AddOutput(@"the area is warm"); break; } case EStoryProgression.FireHot: { AddOutput(@"the area is hot"); Timer timer = new Timer((_) => { AddOutput(@"the strange creature shifts into a humanoid form"); AddOutput(@"the strange creature says it can build stuff"); _workerService.EnableWorker(typeof(Builder)); _workerService.AddPersonToWorker(typeof(IdleWorker)); _workerService.AddPersonToWorker(typeof(Builder)); //_workerService. }, null, 7_500 / _state.HyperState.DivideBy, -1); break; } case EStoryProgression.Initial: default: { AddOutput(@"the area is hot"); break; } } _progression++; }