Game.Prefabs.AgeMask
Assembly: Assembly-CSharp (typical game assembly; actual assembly may vary)
Namespace: Game.Prefabs
Type: enum (flags)
Base: System.Enum (underlying type: byte)
Summary:
AgeMask is a [Flags] enum used to represent one or more age groups for prefabs/entities (e.g., citizens). Each named value maps to a single bit so multiple age groups can be combined with bitwise operations. The Any value contains all age bits (0xF), representing every age group.
Fields
-
Child = 1
Represents the "Child" age group (bit 0). -
Teen = 2
Represents the "Teen" age group (bit 1). -
Adult = 4
Represents the "Adult" age group (bit 2). -
Elderly = 8
Represents the "Elderly" age group (bit 3). -
Any = 0xF
A convenience value with all defined age bits set (Child | Teen | Adult | Elderly). Use to indicate "any age."
Properties
- None.
This enum exposes only named flag values; no additional properties are defined.
Constructors
- None.
Enums do not define instance constructors in the source; values are the named constants above.
Methods
- None implemented on the enum type itself.
Use standard enum/bitwise operations and helper APIs: - Combine flags:
AgeMask.Child | AgeMask.Teen
- Test flags:
(mask & AgeMask.Adult) != 0
ormask.HasFlag(AgeMask.Adult)
Usage Example
// Combine age groups
AgeMask mask = AgeMask.Child | AgeMask.Teen;
// Check for a specific age group
bool hasAdult = (mask & AgeMask.Adult) != 0;
// Set all ages
AgeMask all = AgeMask.Any;
// Typical pattern when filtering or matching prefabs/entities:
if ((entity.AgeMask & AgeMask.Adult) != 0)
{
// entity applies to adults
}