Skip to content

Game.Prefabs.StatisticTriggerType

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: enum

Base: System.Enum (underlying type: System.Int32)

Summary:
Defines the ways a statistic can be interpreted when used as a trigger condition for game logic or prefabs. Each enum value describes how the raw statistic value is evaluated (absolute total, average, or change-based comparisons).


Fields

  • TotalValue
    Represents the statistic's total (aggregate) value. Use this when the trigger should evaluate the summed or raw value (e.g., total population, total income).

  • AverageValue
    Represents the average value of the statistic across a set of items or time window. Use this when the trigger should consider mean values (e.g., average traffic per road, average satisfaction).

  • AbsoluteChange
    Represents an absolute change compared to a previous value (difference). Use this when the trigger should respond to fixed increases/decreases (e.g., change of +50 units).

  • RelativeChange
    Represents a relative (percentage) change compared to a previous value. Use this when the trigger should respond to proportional changes (e.g., a 10% drop).

Properties

  • This enum has no properties.
    Enums don't declare instance properties. Use System.Enum static and instance helper methods (e.g., ToString, HasFlag) if needed.

Constructors

  • No explicit constructors
    C# enums do not define custom constructors. The underlying type is Int32 and the default enum value is the member with numeric value 0 (here, TotalValue unless otherwise specified).

Methods

  • No custom methods
    There are no methods declared on this enum. Standard System.Enum methods are available (ToString(), Parse(), TryParse(), GetValues(), HasFlag(), etc.).

Usage Example

// Example: evaluating a statistic trigger type
void EvaluateTrigger(StatisticTriggerType triggerType, float currentValue, float previousValue)
{
    bool triggered = false;

    switch (triggerType)
    {
        case StatisticTriggerType.TotalValue:
            triggered = currentValue > 1000f; // example threshold
            break;

        case StatisticTriggerType.AverageValue:
            triggered = currentValue > 50f; // average threshold
            break;

        case StatisticTriggerType.AbsoluteChange:
            triggered = (currentValue - previousValue) > 20f; // absolute change threshold
            break;

        case StatisticTriggerType.RelativeChange:
            if (previousValue != 0f)
                triggered = ((currentValue - previousValue) / Math.Abs(previousValue)) > 0.10f; // >10% change
            break;
    }

    if (triggered)
    {
        // Perform trigger action
    }
}