Skip to content

Game.Prefabs.PassengerTypeInfo

Assembly:
Assembly-CSharp

Namespace:
Game.Prefabs

Type:
class

Base:
System.Object

Summary:
Represents a mapping between a passenger category (PassengerType) and a color (UnityEngine.Color). This serializable POCO is intended for use in Unity serialization (inspector, ScriptableObjects, MonoBehaviours) to associate a visual color with a passenger type used by the transport systems. The PassengerType enum is defined in the Game.City namespace.


Fields

  • public UnityEngine.Color m_Color
    Color used to represent the passenger type in UI/visualization (e.g., transport overlays, legend). Since the class is marked [Serializable], this field will be serialized by Unity and shown in the inspector when the containing object is serialized.

  • public PassengerType m_PassengerType
    The passenger category represented by this entry. PassengerType is an enum from the Game.City namespace; use the appropriate enum value to identify the group (for example, different fare classes, demographic groups, or transport-specific passenger categories).

Properties

  • This type defines no properties. It exposes two public fields for direct access and Unity serialization.

Constructors

  • public PassengerTypeInfo()
    No explicit constructor is defined in the source; the C# compiler provides a default parameterless public constructor. Initialization of fields defaults to Color.black (or Color default) for m_Color and the enum default (usually the 0 value) for m_PassengerType unless set explicitly.

Methods

  • This type defines no methods. It is a simple data container (DTO/POCO) used for serialization and data transfer.

Usage Example

using UnityEngine;
using Game.Prefabs;
using Game.City;

// Example: a ScriptableObject holding a list of passenger type color mappings
[CreateAssetMenu(menuName = "Transport/PassengerTypeColors")]
public class PassengerTypeColorTable : ScriptableObject
{
    public PassengerTypeInfo[] entries;
}

// Example of creating and initializing an instance in code
var info = new PassengerTypeInfo();
info.m_PassengerType = PassengerType.Commuter; // example enum value
info.m_Color = Color.cyan;

// Or when used inside a MonoBehaviour to expose mappings in the inspector:
public class ExampleComponent : MonoBehaviour
{
    public PassengerTypeInfo[] passengerMappings;
}

Notes: - Because the class is marked [Serializable] and uses public fields, Unity will serialize and display these values in the inspector when the class is part of a serialized object (MonoBehaviour/ScriptableObject). - If you need validation or computed values, wrap this data into a higher-level class or add utility methods elsewhere rather than modifying this simple DTO.