Skip to content

Game.Prefabs.EffectCondition

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
public struct

Base:
System.ValueType

Summary:
Serializable data container used by prefab/effect systems to describe conditions under which an effect should be active. It groups three flag sets (required, forbidden and intensity) that are typically represented by an enum bitmask (EffectConditionFlags). The struct is suitable for Unity serialization (marked with [Serializable]) and is intended to be embedded in prefab data or other serializable game objects to control effect spawning/behavior.


Fields

  • public EffectConditionFlags m_RequiredFlags
    Flags that must be present for the effect to be considered active. All bits set here are expected to be satisfied by the current context/state for the effect to apply.

  • public EffectConditionFlags m_ForbiddenFlags
    Flags that must NOT be present for the effect to be considered active. If any of these bits are present in the current context/state the effect should be suppressed.

  • public EffectConditionFlags m_IntensityFlags
    Flags used to indicate intensity/variation categories for the effect (for example low/medium/high variations). These are typically consulted to choose a variant of the effect rather than to permit/reject it.

Properties

  • No public properties.
    This struct exposes only public fields and relies on Unity/C# serialization; there are no encapsulated properties.

Constructors

  • public EffectCondition()
    Default parameterless constructor (auto-provided for structs). Initialize fields to default enum value (usually zero). Use object initializer to set specific flags.

Methods

  • None declared in this struct.
    All behavior is expected to be implemented by code that reads these flags (for example prefab/effect managers). Typical checks use bitwise operations or Enum.HasFlag against the current environment/state flags.

Usage Example

// Example usage assuming an EffectConditionFlags enum with bitmask values:
// (EffectConditionFlags.NearWater, .Raining, .HighIntensity, etc.)

// Create/assign an effect condition for a prefab
var effectCondition = new Game.Prefabs.EffectCondition
{
    m_RequiredFlags = EffectConditionFlags.NearWater | EffectConditionFlags.Daytime,
    m_ForbiddenFlags = EffectConditionFlags.Raining,
    m_IntensityFlags = EffectConditionFlags.HighIntensity
};

// Later, when determining whether to spawn an effect:
EffectConditionFlags currentFlags = GetCurrentEnvironmentFlags();

bool requiredSatisfied = (effectCondition.m_RequiredFlags & currentFlags) == effectCondition.m_RequiredFlags;
bool forbiddenPresent = (effectCondition.m_ForbiddenFlags & currentFlags) != 0;

if (requiredSatisfied && !forbiddenPresent)
{
    // spawn or activate effect, possibly selecting variant based on m_IntensityFlags
}

Notes: - EffectConditionFlags is assumed to be an enum decorated for bitwise use. Use bitwise checks (as shown) or Enum.HasFlag where appropriate. - Because fields are public and the struct is [Serializable], these values are compatible with Unity inspector/serialization and will be saved with prefab data.