コード例 #1
0
    void UpdateFinances()
    {
        //revenue
        ulong revenue = (ulong)Mathf.Round((float)simParam.baseFundsGainRate * statEffects.revenueEffectModifier) + statEffects.revenueEffectBonus;

        finances.AddFunds(revenue);

        //expenses
        //excavation:
        float excavationAreaInCells = Mathf.PI * Mathf.Pow(workPlan.excavationAreaRadius, 2.0f) / Mathf.Pow(Grid.cellSize, 2.0f);
        ulong excavationExpense     = (ulong)Mathf.RoundToInt(excavationAreaInCells * (float)simParam.baseExcavationCostPerCell);

        //other
        ulong buildingExpenses = GameManager.buildMan.ComputeBuildingsExpenses();
        ulong wages            = GameManager.popMan.ComputeTotalWages();

        finances.SubtractFunds(excavationExpense + buildingExpenses + wages);
    }