Game.Simulation.IWaterStatisticsSystem
Assembly:
Namespace: Game.Simulation
Type: Interface
Base: None
Summary:
Interface used by the simulation to expose aggregated water-related statistics for fresh water supply and sewage. Implementations provide read-only integer values that represent current capacity, consumption (demand), and the portion of that demand that is actually fulfilled for both fresh water and sewage. These values are useful for UI displays, diagnostics, balancing systems, or other simulation subsystems that need a snapshot of water/sewage status.
Fields
- This interface defines no fields.
Implementations may use internal/private fields to store and update values, but the interface exposes only properties.
Properties
-
int freshCapacity
Current total capacity available for fresh water (e.g., combined output of water facilities, pumping capacity, or network throughput). Interpreted as an instantaneous/snapshot value provided by the implementing system. -
int freshConsumption
Current total fresh water demand/consumption requested by the city (sum of demands from buildings/units). Use this to determine shortages versus capacity. -
int fulfilledFreshConsumption
Amount of the fresh water demand that is actually being satisfied (i.e., how much of freshConsumption is supplied). The difference between freshConsumption and fulfilledFreshConsumption indicates unmet demand. -
int sewageCapacity
Current total capacity available for sewage handling (e.g., capacity of sewage treatment or network throughput). Provided as an instantaneous/snapshot value. -
int sewageConsumption
Current total sewage output/demand (sum of sewage produced by buildings/units) that needs to be handled by the sewage system. -
int fulfilledSewageConsumption
Amount of the sewage demand that is actually being handled/processed. The difference between sewageConsumption and fulfilledSewageConsumption indicates sewer overflows or unmet sewage-handling capacity.
Constructors
- Interfaces do not define constructors.
Implementing classes will provide their own constructors and initialization logic.
Methods
- This interface does not declare any methods.
Any update, reset, or calculation behavior is left to implementations; consumers read the snapshot via the properties.
Usage Example
// Example implementation of IWaterStatisticsSystem
public class WaterStatisticsSystem : IWaterStatisticsSystem
{
private int _freshCapacity;
private int _freshConsumption;
private int _fulfilledFreshConsumption;
private int _sewageCapacity;
private int _sewageConsumption;
private int _fulfilledSewageConsumption;
public int freshCapacity => _freshCapacity;
public int freshConsumption => _freshConsumption;
public int fulfilledFreshConsumption => _fulfilledFreshConsumption;
public int sewageCapacity => _sewageCapacity;
public int sewageConsumption => _sewageConsumption;
public int fulfilledSewageConsumption => _fulfilledSewageConsumption;
// Example update method that the simulation would call each frame/tick
public void UpdateSnapshot(int newFreshCapacity, int newFreshConsumption, int newFulfilledFresh,
int newSewageCapacity, int newSewageConsumption, int newFulfilledSewage)
{
_freshCapacity = newFreshCapacity;
_freshConsumption = newFreshConsumption;
_fulfilledFreshConsumption = newFulfilledFresh;
_sewageCapacity = newSewageCapacity;
_sewageConsumption = newSewageConsumption;
_fulfilledSewageConsumption = newFulfilledSewage;
}
}
// Example consumer reading the stats
void DisplayWaterStats(IWaterStatisticsSystem stats)
{
Debug.Log($"Fresh: {stats.fulfilledFreshConsumption}/{stats.freshConsumption} (Capacity: {stats.freshCapacity})");
Debug.Log($"Sewage: {stats.fulfilledSewageConsumption}/{stats.sewageConsumption} (Capacity: {stats.sewageCapacity})");
}
Notes: - Values exposed by implementations are typically snapshots for the current simulation tick/frame. - Consumers should treat these as instantaneous totals and not attempt to modify them through the interface.