private static void CollectorGather(Collector coll, KeyedVector <ResourceType> delta) { var cur = delta.Zeroed(); var location = coll.Location; foreach (var deposit in location.Terrain.Resources) { cur[deposit.Type] += deposit.Richness; } foreach (var feautre in location.MapFeautres) { foreach (var deposit in feautre.Resources) { cur[deposit.Type] += deposit.Richness; } } foreach (var res in cur) { if (res.Value < 0) { cur[res.Key] = 0; } } cur.Filter(coll.Type.Collected); delta.Add(cur); }
public Settlement(string name, Point position, int population, KeyedVector <ResourceType> resources) { Name = name; Position = position; Resources = resources; Population = population; Collectors = new(); Buildings = new(); Prices = Resources.Zeroed(); foreach (var resource in Resources) { Prices[resource.Key] = resource.Key.BasePrice; } }