Esempio n. 1
0
 public IEnumerator DisplayHarvestedResourcesCoroutine(Entity entity) {
     ResourcesToHarvest resources = entity.entitySO.resources;
     Vector3 position = entity.transform.position;
     foreach (KeyValuePair<ResourceType, ArrayRessources> resource in resources) {
         ResourceHarvestedUI harvested = Instantiate(PopulationPoints.Instance.resourceGainedPrefab, position, Quaternion.identity, transform.parent).GetComponent<ResourceHarvestedUI>();
         harvested.Initialize(resource.Key, resource.Value.gain[entity.HarvestedBonus]);
         yield return new WaitForSeconds(1);
     }
 }
Esempio n. 2
0
        public HarvestInfo ChangeResources(InventoryAmount changes, bool add = true)//TODO make simple clone
        {
            var rToHarvest       = ResourcesToHarvest.ToDictionary(entry => entry.Key, entry => entry.Value);
            var initialResources = InitialResources.ToDictionary(entry => entry.Key, entry => entry.Value);

            foreach (var change in changes.Amount)
            {
                rToHarvest[change.Key] += add ? change.Value : -change.Value;
            }
            return(new HarvestInfo(CanBeChopped, CanBeMined, rToHarvest, initialResources, CanChop, CanMine, CanBeHarvestAttacked, CanHarvestAttack));
        }