Skip to content

Game.Prefabs.UnlockFlags

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs

Type: public enum UnlockFlags : uint

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

Summary:
A bitwise flags enumeration used to describe how unlock conditions are evaluated. Marked with [Flags], values can be combined to represent multiple unlock behaviors. Typical scenarios: RequireAll means all conditions must be met; RequireAny means any single condition is sufficient.


Fields

  • RequireAll = 1u
    Represents the requirement that all specified conditions must be satisfied. Use when every condition in a set must be true.

  • RequireAny = 2u
    Represents the requirement that any one of the specified conditions is sufficient. Use when only one condition among a set must be true.

Properties

  • This enum does not declare properties. (Use standard System.Enum/static helpers if needed.)

Constructors

  • This enum does not declare any constructors beyond the default behavior provided by System.Enum.

Methods

  • This enum does not declare any custom instance methods. Use the standard System.Enum methods (e.g., Enum.HasFlag, Enum.Parse) or bitwise operators to work with values.

Usage Example

// Combine flags
UnlockFlags flags = UnlockFlags.RequireAll | UnlockFlags.RequireAny;

// Check with HasFlag
bool hasAll = flags.HasFlag(UnlockFlags.RequireAll);
bool hasAny = flags.HasFlag(UnlockFlags.RequireAny);

// Bitwise check (more efficient than HasFlag)
bool hasAllBitwise = (flags & UnlockFlags.RequireAll) == UnlockFlags.RequireAll;

// Typical pattern: evaluate unlock based on flags
bool EvaluateUnlock(UnlockFlags mode, IEnumerable<bool> conditions)
{
    if ((mode & UnlockFlags.RequireAll) == UnlockFlags.RequireAll)
    {
        return conditions.All(c => c);
    }
    if ((mode & UnlockFlags.RequireAny) == UnlockFlags.RequireAny)
    {
        return conditions.Any(c => c);
    }
    // Default / fallback behavior
    return false;
}