Game.Objects.ElevationFlags
Assembly:
Unknown (likely the main Game assembly used by Cities: Skylines 2)
Namespace: Game.Objects
Type: public enum
Base: System.Enum (underlying type: byte)
Summary: A bitmask enum representing elevation-related states for game objects. Marked with the [Flags] attribute so multiple states can be combined (e.g., Stacked | Lowered). Underlying storage is a byte, so it is compact for storage in per-object data structures.
Fields
-
Stacked = 1
Represents that the object is stacked (e.g., placed on top of another object). -
OnGround = 2
Represents that the object is on ground level. -
Lowered = 4
Represents that the object has been lowered (e.g., lowered below ground or a lowered placement state).
Properties
- None This enum exposes no properties. Use bitwise operations or Enum.HasFlag to inspect values.
Constructors
- Implicit default constructor As with all enums, a default value of 0 (no flags set) exists. No explicit constructors are defined.
Methods
- None defined on the enum itself Standard System.Enum methods are available (ToString, HasFlag, etc.). For performance-sensitive code, prefer bitwise checks over Enum.HasFlag to avoid boxing.
Notes on usage: - Values are powers of two and intended to be combined as flags. - Valid combined examples: Stacked | Lowered, OnGround | Lowered.
Usage Example
// Set flags
ElevationFlags flags = ElevationFlags.Stacked | ElevationFlags.Lowered;
// Check flags (recommended: bitwise check to avoid boxing)
bool isLowered = (flags & ElevationFlags.Lowered) != 0;
bool isOnGround = (flags & ElevationFlags.OnGround) != 0;
// Alternative (less performant due to boxing)
bool hasStacked = flags.HasFlag(ElevationFlags.Stacked);
// Clear a flag
flags &= ~ElevationFlags.Lowered;
// Toggle a flag
flags ^= ElevationFlags.OnGround;
Additional guidance: - Use this enum when you need to store compact elevation state for objects (e.g., in entity/component data). - Keep checks fast in hot code paths by using bitwise operators rather than HasFlag.