Game.Simulation.IMilestoneSystem
Assembly: Assembly-CSharp.dll (common game assembly; adjust if different)
Namespace: Game.Simulation
Type: interface
Base: none
Summary:
Interface that exposes read-only milestone / experience (XP) information for the game's milestone progression system. Implementations provide the current XP state, XP thresholds for the current/previous/next milestones, a normalized progress value, and the identifier/index of the next milestone.
Fields
- (none)
No backing fields are defined by the interface. Concrete implementations will provide their own storage.
Properties
-
int currentXP
Current accumulated experience points (XP) toward milestones. Typically a non-negative integer representing the player's/city's present XP total. -
int requiredXP
XP required for the current milestone (or the next milestone threshold that the player is actively working towards). Used together with lastRequiredXP to determine progress within the current milestone bracket. -
int lastRequiredXP
XP threshold of the previous milestone (the XP required at the start of the current milestone tier). Useful for computing how far into the current milestone range the currentXP is. -
int nextRequiredXP
XP required for the subsequent milestone following requiredXP. May be equal to requiredXP if milestones do not strictly increase or if implementation uses different semantics — check concrete implementation. -
float progress
Normalized progress through the current milestone range, usually in the range [0.0, 1.0]. Common calculation: (currentXP - lastRequiredXP) / (requiredXP - lastRequiredXP), with safe-guarding for division-by-zero. -
int nextMilestone
Identifier or index of the next milestone that will be reached when requiredXP is met. The concrete meaning (ID vs. index) depends on the implementation.
Constructors
- (none)
Interfaces do not declare constructors. Implementing types provide construction semantics.
Methods
- (none)
This interface exposes only read-only properties; there are no methods declared here.
Usage Example
// Example implementation of IMilestoneSystem
public class MilestoneSystem : IMilestoneSystem
{
private int _currentXP;
private int _lastRequiredXP;
private int _requiredXP;
private int _nextRequiredXP;
private int _nextMilestoneId;
public int currentXP => _currentXP;
public int requiredXP => _requiredXP;
public int lastRequiredXP => _lastRequiredXP;
public int nextRequiredXP => _nextRequiredXP;
public int nextMilestone => _nextMilestoneId;
public float progress
{
get
{
int span = _requiredXP - _lastRequiredXP;
if (span <= 0) return 0f;
return Mathf.Clamp01((float)(_currentXP - _lastRequiredXP) / span);
}
}
public MilestoneSystem(int startXP, int lastReq, int req, int nextReq, int nextId)
{
_currentXP = startXP;
_lastRequiredXP = lastReq;
_requiredXP = req;
_nextRequiredXP = nextReq;
_nextMilestoneId = nextId;
}
// Methods to update XP and recalculate thresholds would be added in the concrete class.
}
Notes: - All members are read-only on the interface; mutating or update methods must be provided by the concrete implementation. - Interpretations of "nextMilestone" and the exact semantics of the XP thresholds can vary between implementations — consult the specific implementation used by the mod or game API for exact behavior.