Game.Simulation.IBudgetSystem
Assembly: Assembly-CSharp.dll
Namespace: Game.Simulation
Type: Interface
Base: (none — interface)
Summary:
Interface that exposes read-only budget-, economy- and population-related metrics from the simulation. Implementations provide access to trade statistics, wealth and worker counts for households and companies, citizen wellbeing, and tourist/lodging data. Useful for mods and systems that need to query aggregated economic state (trade values, wealth, counts, and basic wellbeing/tourist metrics) from the game simulation.
Fields
- This interface defines no fields.
{{ The interface is a contract for read-only accessors and does not store state itself; fields exist on concrete implementations. }}
Properties
-
public bool HasData { get; }
{{ Returns true when the implementing system has initialized or has available simulation data to query. Use this to guard calls to the other members when the simulation is not yet producing metrics. }} -
public uint LastUpdate { get; }
{{ Timestamp or tick id (simulation frame) of the last update of the reported data. Useful to detect stale data or to throttle queries to once-per-simulation-update. The exact time base is the simulation's internal tick counter. }}
Constructors
- Interfaces have no constructors.
{{ Implementations of IBudgetSystem will provide construction/initialization as appropriate. }}
Methods
-
int GetTrade(Resource resource)
{{ Returns the current trade count/volume for the specified Resource. Resource is defined in Game.Economy. The returned integer is in the game's internal units for trade counts. }} -
int GetTradeWorth(Resource resource)
{{ Returns the economic value (worth) of the trade for the specified Resource. The value is an integer using the game's economy units (currency). Combine with GetTotalTradeWorth() to get per-resource and total trade valuation. }} -
int GetHouseholdWealth()
{{ Returns an aggregated household wealth value (sum/metric) for the city. The exact semantics (average, total, scaled metric) depend on the implementation used by the game; treat it as an aggregate wealth indicator for households. }} -
int GetCompanyWealth(bool service, Resource resource)
{{ Returns an aggregated wealth/valuation metric for companies of the specified type/resource. The boolean service typically distinguishes service-sector companies (true) from industrial/production companies (false). The Resource parameter filters by the resource produced/handled. }} -
int GetTotalTradeWorth()
{{ Returns the total trade monetary value across all resources. Equivalent to summing GetTradeWorth for all tracked Resource values. }} -
int GetHouseholdCount()
{{ Returns the current count of household units (e.g., residential buildings or household entries as tracked by the simulation). }} -
int GetCompanyCount(bool service, Resource resource)
{{ Returns the number of companies matching the specified filters (service vs non-service and the given Resource). Use to inspect company counts per sector/resource. }} -
int2 GetHouseholdWorkers()
{{ Returns a two-component integer vector (Unity.Mathematics.int2) describing household worker statistics. The exact meaning of each component is provided by the implementation (commonly used as an ordered pair of worker-related counts). Inspect the concrete implementation or in-game docs for exact component semantics. }} -
int2 GetCompanyWorkers(bool service, Resource resource)
{{ Returns company worker counts as a two-component integer vector for the filtered companies. The two components represent related worker metrics (see implementation-specific docs). The service boolean and Resource filter which companies are aggregated. }} -
float2 GetCitizenWellbeing()
{{ Returns a two-component floating-point vector (Unity.Mathematics.float2) representing citizen wellbeing metrics. Each component corresponds to a wellbeing-related value tracked by the system (for example: current and normalized scores), but exact semantics are implementation-dependent. }} -
int GetTouristCount()
{{ Returns the current estimated number of tourists present in the city as an integer count. }} -
int2 GetLodgingData()
{{ Returns lodging-related aggregated data as an int2 (two-component integer vector). Typical usages include counts of lodging capacity and occupied lodging, but exact component meanings depend on the game's implementation. }} -
int GetTouristIncome()
{{ Returns the income generated by tourists as an integer (game-currency units). This is a convenience metric for mods that need to measure tourist-driven revenue. }}
Usage Example
// Example usage inside a mod system that receives or resolves an IBudgetSystem instance
public class MyEconomyReporter
{
private IBudgetSystem _budget;
public MyEconomyReporter(IBudgetSystem budgetSystem)
{
_budget = budgetSystem;
}
public void Report()
{
if (_budget == null || !_budget.HasData)
return;
uint tick = _budget.LastUpdate;
int totalTradeWorth = _budget.GetTotalTradeWorth();
int householdCount = _budget.GetHouseholdCount();
int touristCount = _budget.GetTouristCount();
float2 wellbeing = _budget.GetCitizenWellbeing();
UnityEngine.Debug.Log($"Tick {tick}: TradeWorth={totalTradeWorth}, Households={householdCount}, Tourists={touristCount}, Wellbeing=({wellbeing.x}, {wellbeing.y})");
}
}
{{ Notes: - Resource is defined in Game.Economy; use the enum/structure from that namespace to filter resource-specific queries. - int2 and float2 refer to Unity.Mathematics types (two-component vectors). - The interface provides read-only querying; modifications must be done through the appropriate economy/budget control systems provided by the game. - Because some component semantics (the meaning of int2/float2 components) are implementation-specific, consult the concrete game/engine documentation or the implementing class for exact details when precision is required. }}