Skip to content

Game.Prefabs.TrainFlags

Assembly: Game (inferred)
Namespace: Game.Prefabs

Type: enum (flags)

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

Summary:
TrainFlags is a small flags enum (byte-backed) used to mark characteristics of train prefabs. It uses the [Flags] attribute, so multiple values can be combined bitwise (for example, a multi-unit electric train would have both MultiUnit and Pantograph). These flags typically influence rendering, coupling/formation logic, and compatibility with electrification systems.


Fields

  • MultiUnit = 1
    Indicates the prefab represents a unit that can form multi-unit train sets (coupled vehicles). Systems reading this flag may spawn or treat the vehicle as part of a multi-car set, enable coupling visuals/logic, or alter pathing/formation behavior.

  • Pantograph = 2
    Indicates the prefab has a pantograph (overhead current collector). This flag can be used to determine compatibility with electrified lines, apply pantograph visuals/animations, or affect audio/visual effects related to electric operation.

Properties

  • This enum defines no properties. It is a simple flag set; use bitwise operations or System.Enum helpers (HasFlag) to query combined values.

Constructors

  • No public constructors. As with all enums, a default value of 0 (no flags set) exists implicitly.

Methods

  • No methods are declared on this enum. Standard System.Enum methods are available (ToString, HasFlag, etc.).

Usage Example

// Combine flags
TrainFlags flags = TrainFlags.MultiUnit | TrainFlags.Pantograph;

// Check with bitwise operator
if ((flags & TrainFlags.Pantograph) != 0)
{
    // handle pantograph-specific logic
}

// Or use HasFlag (boxing cost)
if (flags.HasFlag(TrainFlags.MultiUnit))
{
    // handle multi-unit behavior
}

// Store/serialize as byte
byte raw = (byte)flags;
TrainFlags restored = (TrainFlags)raw;