public float Produce() { float value = 0; Building[] buildingsInRange = GetCity().GetBuildingsAroundTile(_tileAffectRange, this.GetBuildingTile()); foreach (Building pBuilding in buildingsInRange) { if (pBuilding is CollectionBuilding) { CollectionBuilding prodBuilding = pBuilding as CollectionBuilding; StartCoroutine(PlayParticle()); //prodBuilding.Collect(_moneyGain, _happinessGain); value += GetIncomeWithMultiplier(); } } return(value); }
public void SetBuildingInfoText(Building pBuilding) { if (pBuilding is ProductionBuilding) { ProductionBuilding prodBuilding = pBuilding as ProductionBuilding; int[] values = prodBuilding.GetMoneyHappinessRange(); _buildInfoText.text = "<b>" + prodBuilding.GetType() + "</b>\nBuilding cost: <b>" + prodBuilding.GetCost() + "</b>\nProvides <b>" + values[0] + "</b> income each turn\nAnd has a range of <b>" + values[2] + "</b>"; } if (pBuilding is CollectionBuilding) { CollectionBuilding colBuilding = pBuilding as CollectionBuilding; _buildInfoText.text = "<b>" + colBuilding.GetType() + "</b>\nBuilding cost: <b>" + colBuilding.GetCost() + "</b>\nThis building collects resources from nearby <b>factories</b>."; } if (pBuilding is FunctionBuilding) { FunctionBuilding funBuilding = pBuilding as FunctionBuilding; _buildInfoText.text = "<b>" + funBuilding.GetType() + "</b>\nBuilding cost: <b>" + funBuilding.GetCost() + "</b>\n" + funBuilding.GetDescription(); } }
public void SetExamineMode(Building pBuilding) { ToggleExaminePanel(true); string text = "This is a <b>" + pBuilding.GetType() + "</b>\n"; if (pBuilding is ProductionBuilding) { ProductionBuilding prodBuilding = pBuilding as ProductionBuilding; text += "It produces <b>" + prodBuilding.GetMoneyHappinessRange()[0] + "</b> Income\nFor every house in a range of "; text += "<b>" + prodBuilding.GetMoneyHappinessRange()[2] + "</b> tile"; } else if (pBuilding is CollectionBuilding) { CollectionBuilding colBuilding = pBuilding as CollectionBuilding; text += "It collects resources from production buildings in range.\n"; } else if (pBuilding is FunctionBuilding) { FunctionBuilding funBuilding = pBuilding as FunctionBuilding; text += funBuilding.GetDescription(); } _examineText.text = text; }