Skip to content

Game.Citizens.CitizenAge

Assembly: Assembly-CSharp
Namespace: Game.Citizens

Type: enum

Base: System.Enum

Summary:
Defines the discrete age categories used by the game's citizen system. This enum is used to classify citizens into age groups (Child, Teen, Adult, Elderly) for gameplay logic such as service availability, animations, growth/aging systems, and behavior rules. The underlying type is the default integer (int) and enum members are assigned sequential values starting at 0 unless explicitly set.


Fields

  • Child
    Represents the youngest age group. Typically used to select child-specific models, animations, and service interactions (e.g., schooling). This member has the default numeric value 0.

  • Teen
    Represents adolescent citizens. Used for teen-specific behaviors and transitions (e.g., school-to-work progression). Numeric value 1 by default.

  • Adult
    Represents the primary working-age population. Used for adult behavior, employment, and most service interactions. Numeric value 2 by default.

  • Elderly
    Represents the senior age group. Used for elderly-specific behavior, retirement logic, and service needs. Numeric value 3 by default.

Properties

  • None.
    Enums do not define instance properties; they are simple value types representing named constants.

Constructors

  • None (implicit/default)
    Enums are value types with an implicit default value equal to the first declared constant (here, CitizenAge.Child). There are no accessible constructors to instantiate enums beyond casting or assigning named members.

Methods

  • None.
    No methods are declared on this enum. Standard enum operations (casting, comparisons, Enum methods like Enum.GetNames/GetValues) from System.Enum apply.

Usage Example

using Game.Citizens;

public class CitizenController
{
    public void HandleCitizen(CitizenAge age)
    {
        switch (age)
        {
            case CitizenAge.Child:
                // assign school schedule, child animation set, etc.
                break;
            case CitizenAge.Teen:
                // teen-specific logic
                break;
            case CitizenAge.Adult:
                // employment, taxes, standard behavior
                break;
            case CitizenAge.Elderly:
                // retirement, different service priorities
                break;
        }
    }

    public bool IsOfWorkingAge(CitizenAge age) => age == CitizenAge.Adult;

    public void ExampleCast()
    {
        int rawValue = 2;
        CitizenAge ageFromInt = (CitizenAge)rawValue; // yields CitizenAge.Adult
    }
}

{{ This enum is a simple classification used across citizen-related systems. When integrating with serialization, UI, or save/load logic, treat the enum's numeric values as part of the saved format or map them explicitly to avoid issues if the enum definition changes later. }}