Exemple #1
0
    protected void Produce()
    {
        float maxPercentageToAdd = 100f / 10f;
        float percentageToAdd    = maxPercentageToAdd * CitizenFactor();

        productionRound += percentageToAdd;

        if (productionRound < 100f)
        {
            return;
        }
        productionRound = 0f;
        List <ResAmount> actualInputs = new List <ResAmount>();

        foreach (ResAmount input in inputs)
        {
            actualInputs.Add(new ResAmount(input.GetResType(), input.GetAmount()));
        }

        List <ResAmount> actualOutputs = new List <ResAmount>();

        foreach (ResAmount output in outputs)
        {
            actualOutputs.Add(new ResAmount(output.GetResType(), output.GetAmount()));
        }

        if (ResourceHolder.CanAfford(actualInputs))
        {
            ResourceHolder.Consume(actualInputs);
            ResourceHolder.Produce(actualOutputs);
        }
    }