Game.City.ExpenseSource
Assembly: Assembly-CSharp
Namespace: Game.City
Type: enum
Base: System.Enum
Summary:
ExpenseSource is an enumeration used by the city's finance/economy systems to categorize where a particular outgoing cost (expense) originated. Each enum value identifies a specific kind of recurring or one-off expense the city can incur (subsidies, loan interest, import costs for utilities and services, upkeep, etc.). The Count entry is a sentinel representing the number of entries in the enum.
Fields
-
SubsidyResidential
Represents subsidies/payments made to residential zones or programs targeted at residential development. -
LoanInterest
Interest payments on outstanding city loans or bonds. -
ImportElectricity
Cost incurred when the city imports electricity (power) from external providers or neighboring regions. -
ImportWater
Cost incurred when the city imports water from external sources or neighboring regions. -
ExportSewage
Cost associated with exporting sewage (e.g., sending sewage off-map or to external treatment). Treated as an expense source. -
ServiceUpkeep
General upkeep/maintenance costs for city-owned services and infrastructure. -
SubsidyCommercial
Subsidies/payments made to commercial zones or programs targeted at commercial development. -
SubsidyIndustrial
Subsidies/payments made to industrial zones or programs targeted at industrial development. -
SubsidyOffice
Subsidies/payments made to office zones or office sector development. -
ImportPoliceService
Cost for importing police services (e.g., paying for external police coverage or inter-city agreements). -
ImportAmbulanceService
Cost for importing ambulance/medical emergency services from external providers. -
ImportHearseService
Cost for importing hearse/morgue-related services from external providers. -
ImportFireEngineService
Cost for importing firefighting services (fire engines/brigades) from external providers. -
ImportGarbageService
Cost for importing garbage collection/processing services (e.g., contracting out or hauling off-map). -
MapTileUpkeep
Upkeep costs related to map tiles (streaming, loading-related costs, or tile-specific maintenance). -
Count
Sentinel value representing the number of entries in this enum (useful for iteration, array sizing, validation).
Properties
This enum type does not define properties. It is a simple value type representing a discrete set of expense categories.
Constructors
Enums in C# do not define explicit constructors in normal usage. Values are simple named constants backed by an integral type (System.Int32 by default). There are no public constructors to call directly.
Methods
This enum does not define methods. You can, however, use standard System.Enum methods such as Enum.GetValues, Enum.GetName, Enum.TryParse, etc., to work with the values at runtime.
Usage Example
using Game.City;
public class FinanceTracker
{
private readonly decimal[] _expensesPerSource = new decimal[(int)ExpenseSource.Count];
public void AddExpense(ExpenseSource source, decimal amount)
{
_expensesPerSource[(int)source] += amount;
}
public decimal GetTotalExpenses()
{
decimal sum = 0;
for (int i = 0; i < (int)ExpenseSource.Count; i++)
sum += _expensesPerSource[i];
return sum;
}
public void LogExpense(ExpenseSource source, decimal amount)
{
AddExpense(source, amount);
UnityEngine.Debug.Log($"Expense added: {source} = {amount:C}");
}
}
// Example usage:
var finance = new FinanceTracker();
finance.LogExpense(ExpenseSource.LoanInterest, 1250.50m);
finance.LogExpense(ExpenseSource.ImportElectricity, 420.00m);
Notes and tips for modding: - Treat ExpenseSource as a stable list of categories: mods that record, display or filter city expenses should map their data to these enum values. - Use ExpenseSource.Count when creating arrays or iterating over all expense categories to avoid hardcoding the count. - When presenting to players, provide user-friendly labels for each enum value (the enum names are concise and developer-oriented).