Game.LeisureParametersData
Assembly:
Likely Assembly-CSharp (game runtime assembly) — contains game prefab/component definitions.
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary:
LeisureParametersData is a component-style data struct used by the game's ECS code to store references and parameters for leisure-related prefabs and tourist consumption values. It holds Entity references for different leisure prefab types (traveling, attractions, sightseeing) and integer parameters controlling randomization and per-day tourist consumption for lodging and services. The struct implements IComponentData so it can be attached to entities in the Unity DOTS/ECS world and IQueryTypeParameter for query usage.
Fields
-
public Entity m_TravelingPrefab
Holds the Entity reference to the prefab used for "Travel" leisure behavior. This is the prefab spawned/used when LeisureType.Travel is requested. -
public Entity m_AttractionPrefab
Holds the Entity reference to the prefab used for "Attractions" leisure behavior. Used for LeisureType.Attractions. -
public Entity m_SightseeingPrefab
Holds the Entity reference to the prefab used for "Sightseeing" leisure behavior. Used for LeisureType.Sightseeing. -
public int m_LeisureRandomFactor
An integer factor used to introduce randomness into leisure-related decisions or schedules. The consuming systems use this to vary leisure behavior — exact meaning depends on game systems that read it. -
public int m_TouristLodgingConsumePerDay
Number of lodging "units" (or a game-specific measure) consumed per tourist per day. Used by tourist consumption/economy systems. -
public int m_TouristServiceConsumePerDay
Number of service "units" consumed per tourist per day (e.g., entertainment or service demand). Used by the economy/tourist systems.
Properties
- This type exposes no C# properties; it exposes public fields and implements IComponentData / IQueryTypeParameter for ECS usage.
Constructors
public LeisureParametersData()
Default value-type constructor (implicitly provided). Populate fields directly when creating or via entity/authoring conversion workflows.
Methods
public Entity GetPrefab(LeisureType type)
Returns the corresponding prefab Entity for the supplied LeisureType. Implementation uses a switch expression:- LeisureType.Travel -> m_TravelingPrefab
- LeisureType.Attractions -> m_AttractionPrefab
- LeisureType.Sightseeing -> m_SightseeingPrefab
- default -> default(Entity) (which is usually Entity.Null)
Use this to map a leisure category to the prefab Entity to instantiate or reference. Note: ensure the returned Entity is valid before instantiating.
Usage Example
// Assume `parameters` is obtained from an entity that has LeisureParametersData
LeisureParametersData parameters = ...;
// Get the prefab Entity for attractions
Entity attractionPrefab = parameters.GetPrefab(LeisureType.Attractions);
// Check for validity before instantiating
if (attractionPrefab != Entity.Null)
{
// Instantiate or use the prefab via ECS/EntityManager/Instantiator systems
}
Additional notes: - LeisureType is defined in Game.Agents (enum). Ensure you reference the correct enum values. - This struct is intended for use with Unity.Entities (DOTS). When authoring in the editor, conversion systems typically populate these fields from GameObject prefabs.