Skip to content

Game.Simulation.ICityServiceBudgetSystem

Assembly: Game
Namespace: Game.Simulation

Type: Interface

Base: (none)

Summary:
Interface exposing city service budget and finance related operations used by the simulation. Provides methods to query income and expenses by source, total balances, service-specific budgets and efficiencies, counts of service buildings and their worker/workplace counts, and to set service budget percentages. Intended for use by simulation systems and mods that need to inspect or modify service funding and estimate costs.


Fields

  • None.
    No fields are defined on this interface; it only declares methods to be implemented by a concrete system.

Properties

  • None.
    This interface does not expose properties — only methods.

Constructors

  • None.
    Interfaces do not define constructors.

Methods

  • int GetIncome(IncomeSource source)
    Returns the income amount for the specified IncomeSource (enum defined in Game.City). Income is reported in the same units used by the simulation (typically the game's currency per update/tick).

  • int GetExpense(ExpenseSource source)
    Returns the expense amount for the specified ExpenseSource (enum defined in Game.City). Use this to inspect outgoing costs broken down by expense category.

  • int GetBalance()
    Returns the current overall balance (total income − total expenses) for the city/game budget.

  • int GetTotalIncome()
    Returns the total income across all income sources.

  • int GetTotalExpenses()
    Returns the total expenses across all expense sources.

  • int GetTotalTaxIncome()
    Returns the portion of income that comes from taxes (total tax revenue).

  • int GetServiceBudget(Entity servicePrefab)
    Returns the current budget percentage for the given service prefab (typically a value in the 0–100 range, representing percent funding for that service). The parameter is a Unity.Entities.Entity that represents the service prefab.

  • int GetMoneyDelta()
    Returns the change in money for the most recent simulation step (money delta). Useful to quickly see how much cash changed since the last update/tick.

  • void SetServiceBudget(Entity servicePrefab, int percentage)
    Sets the budget percentage for the provided service prefab. Percentage is typically 0–100; implementations should clamp/validate input according to the game's rules.

  • int GetServiceEfficiency(Entity servicePrefab, int budget)
    Returns an estimated service efficiency (as an integer score or percent) for the supplied service prefab at the provided budget percentage. Used to estimate how changes in budget affect service performance.

  • void GetEstimatedServiceBudget(Entity servicePrefab, out int upkeep)
    Calculates and returns an estimated upkeep/upfront cost (via the out parameter) for the given service prefab based on current simulation data/estimates. Useful for showing expected monthly/periodic cost if budget or service counts change.

  • int GetNumberOfServiceBuildings(Entity serviceBuildingPrefab)
    Returns the number of instantiated service-building entities that match the provided service building prefab (count of buildings of that type currently in the simulation).

  • int2 GetWorkersAndWorkplaces(Entity serviceBuildingPrefab)
    Returns an int2 (Unity.Mathematics.int2) where typically x = number of workers employed and y = number of workplaces available for the given service-building prefab. This helps assess staffing shortages or surpluses for a building type.

  • Entity[] GetServiceBuildings(Entity servicePrefab)
    Returns an array of Unity.Entities.Entity instances representing all service-building instances associated with the given service prefab.

Usage Example

// Assume you have obtained a reference to the simulation/system implementation:
ICityServiceBudgetSystem budgetSystem = /* obtain from game's simulation manager or dependency injection */;

// Query total finances
int totalIncome = budgetSystem.GetTotalIncome();
int totalExpenses = budgetSystem.GetTotalExpenses();
int balance = budgetSystem.GetBalance();

// Inspect income by source (IncomeSource enum is in Game.City)
int roadIncome = budgetSystem.GetIncome(IncomeSource.Roads);

// Work with a service prefab entity (obtained elsewhere)
Entity parksServicePrefab = /* prefab entity for Parks service */;
int currentBudget = budgetSystem.GetServiceBudget(parksServicePrefab);

// Set new budget percentage for that service
budgetSystem.SetServiceBudget(parksServicePrefab, 85);

// Estimate upkeep
int estimatedUpkeep;
budgetSystem.GetEstimatedServiceBudget(parksServicePrefab, out estimatedUpkeep);

// Get buildings and staffing info
Entity[] buildings = budgetSystem.GetServiceBuildings(parksServicePrefab);
int buildingCount = budgetSystem.GetNumberOfServiceBuildings(/* some building prefab entity */);
int2 workersAndWorkplaces = budgetSystem.GetWorkersAndWorkplaces(/* building prefab entity */);

Notes: - IncomeSource and ExpenseSource are enums under Game.City; Entity is Unity.Entities.Entity; int2 is Unity.Mathematics.int2. - Concrete access to the implementation depends on the game's system discovery (simulation/world APIs). Ensure calls are performed on appropriate simulation thread/context as required by the game's ECS/API.