Skip to content

Game.Companies.Workshift

Assembly: Assembly-CSharp (game)
Namespace: Game.Companies

Type: public enum Workshift : byte

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

Summary:
Represents the work shift for a company or production unit in the game. The enum defines the three standard shifts (Day, Evening, Night). Stored as a byte to minimize memory and to be compact for serialization in game save data or network messages. Use this enum to control time-of-day related behavior, scheduling, or production modifiers that depend on which shift a company is operating.


Fields

  • Day
    0 — The day shift. Typically corresponds to daytime operation; use when the company operates during daytime hours.

  • Evening
    1 — The evening shift. Use for late-afternoon / early-evening operation.

  • Night
    2 — The night shift. Use for overnight operation; may be associated with different production/worker availability or effects on traffic/noise.

Properties

  • (none)
    This is a simple enum type and does not expose properties.

Constructors

  • (implicit) default constructor
    Enums do not have explicit constructors in user code. The default underlying numeric value for the first member (Day) is 0.

Methods

  • (none declared)
    As with all enums, standard methods from System.Enum/System.ValueType are available (ToString, Parse, TryParse, HasFlag, etc.). No custom methods are declared on this enum.

Usage Example

// Assigning a workshift
Workshift shift = Workshift.Evening;

// Storing in a company-like class
class CompanyInfo {
    public Workshift Shift { get; set; }
}

// Using in logic
void ApplyShiftBehavior(CompanyInfo company) {
    switch (company.Shift) {
        case Workshift.Day:
            // apply day behavior
            break;
        case Workshift.Evening:
            // apply evening behavior
            break;
        case Workshift.Night:
            // apply night behavior
            break;
    }
}

// Serializing to a byte (compact storage)
byte stored = (byte)company.Shift;
company.Shift = (Workshift)stored;

Additional notes: - Because the enum uses an underlying type of byte, it is efficient for saving and network transfer. Be careful when extending the enum to maintain backward compatibility with saved data (avoid reordering or changing existing numeric values).