Class DurationCondition
Met once the condition it wraps has held continuously for the authored number of seconds.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Conditions
Assembly: Serenity.UnityAchievements.Infrastructure.dll
Syntax
[AchievementConditionCategory(AchievementConditionCategory.Metrics)]
public class DurationCondition : SingleChildAchievementCondition
Remarks
This is the "bathe for thirty minutes" shape: the game says whether the player is in the bath, and the accumulation of that state over time is the rule. The elapsed time is kept here because no one else holds it, and it survives a relaunch by default — a thirty-minute requirement that restarted on every launch would effectively demand one unbroken session.
Constructors
DurationCondition()
Creates an unauthored condition, as Unity's polymorphic serializer does.
Declaration
public DurationCondition()
DurationCondition(AchievementCondition, float, bool, bool)
Creates a condition accumulating time while another holds.
Declaration
public DurationCondition(AchievementCondition inner, float requiredSeconds, bool useUnscaledTime = false, bool persistAcrossSessions = true)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementCondition | inner | The condition that has to hold. |
| float | requiredSeconds | How many seconds it must hold for. |
| bool | useUnscaledTime | Whether to count time that ignores the time scale. |
| bool | persistAcrossSessions | Whether the accumulated time survives a relaunch. |
Properties
DisplayName
Declaration
public override string DisplayName { get; }
Property Value
| Type | Description |
|---|---|
| string |
ElapsedSeconds
How many seconds have accumulated so far.
Declaration
public float ElapsedSeconds { get; }
Property Value
| Type | Description |
|---|---|
| float |
MissingChildMessage
What this node reports when it wraps nothing at all.
Declaration
protected override string MissingChildMessage { get; }
Property Value
| Type | Description |
|---|---|
| string |
Overrides
NeedsTick
Declaration
public override bool NeedsTick { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
PersistAcrossSessions
Whether the accumulated time survives a relaunch.
Declaration
public bool PersistAcrossSessions { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PersistsState
Declaration
public override bool PersistsState { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
RequiredSeconds
How many seconds the wrapped condition must hold.
Declaration
public float RequiredSeconds { get; }
Property Value
| Type | Description |
|---|---|
| float |
UseUnscaledTime
Whether the accumulated time ignores the game's time scale.
Declaration
public bool UseUnscaledTime { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
CaptureOwnState()
The node's own counter, for a wrapper that keeps one. Null by default.
Declaration
protected override string CaptureOwnState()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Describe(bool)
Declaration
public override string Describe(bool isNested)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isNested |
Returns
| Type | Description |
|---|---|
| string |
GetProgress(in AchievementEvaluationContext)
Declaration
public override AchievementConditionProgress GetProgress(in AchievementEvaluationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementEvaluationContext | context |
Returns
| Type | Description |
|---|---|
| AchievementConditionProgress |
IsMet(in AchievementEvaluationContext)
Declaration
public override bool IsMet(in AchievementEvaluationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementEvaluationContext | context |
Returns
| Type | Description |
|---|---|
| bool |
Reset()
Declaration
public override void Reset()
Overrides
RestoreOwnState(string)
Restores the node's own counter.
Declaration
protected override void RestoreOwnState(string ownState)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownState | The counter previously produced by CaptureOwnState(). |
Overrides
ValidateOwnConfiguration()
Checks the node's own fields, once the child is known to be present.
Declaration
protected override string ValidateOwnConfiguration()
Returns
| Type | Description |
|---|---|
| string | What is wrong, or null when the node's own configuration is valid. |