protected override IEnumerator ProductionCycle() { while (inProduction) { yield return(null); ProductionTimer += Time.deltaTime; if (ProductionTimer >= ProductionTime) { ItemsStored.Add(new StorageItem(OutputProduct)); ProductionFinished(); ProductionTimer = 0; inProduction = false; } } }
public List <Products> AddProduct(params Products[] products) { List <Products> returnList = new List <Products>(); foreach (Products product in products) { if (ItemsStored.Count < Capacity) { ItemsStored.Add(new StorageItem(product)); } else { returnList.Add(product); } } return(returnList); }
public override void BuildingUpdate() { // for each building count the amount of each tier that there is. int[] TierCounts = new int[4]; foreach (BaseBuilding building in TeamManager.TM.Teams[TeamID].BuildingsList) { if (building.Tier != 0) { ++TierCounts[building.Tier - 1]; } } for (int i = 0; i < 4; ++i) { CumulativeTierAdd[i] += ((float)TierCounts[i] / (float)AmountOfTier[i]) * (Time.deltaTime / Period) * (float)AmountPerTier[i]; //TeamManager.TM.Teams[TeamID].Gold += (int)CumulativeTierAdd[i]; if (CumulativeTierAdd[i] > 1) { for (int j = 0; j < (int)CumulativeTierAdd[i]; ++j) { ItemsStored.Add(new StorageItem(Products.Gold)); } CumulativeTierAdd[i] -= (int)CumulativeTierAdd[i]; } } if (ItemsStored.Count > 5) { // attempt to send courier if (CourierCount > 0) { SendCourierWithProductsFunc(); } } }