Skip to content

Game.Prefabs.Modes.ModeSettingData

Assembly: Assembly-CSharp
Namespace: Game.Prefabs.Modes

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
ModeSettingData is an ECS component that holds configurable gameplay parameters for a specific game mode. It centralizes settings that affect demand calculations (residential, commercial, industrial/office), taxation effects, resource handling and government support behavior. As a plain data struct it is intended to be attached to an entity (for example a singleton "mode settings" entity) and read by systems that implement game-mode-specific simulation logic. Use this component to tune how the mode behaves without changing system code.


Fields

  • public bool m_Enable
    Determines whether this mode setting is active/enabled. Typically used to enable or disable the whole mode or feature set controlled by this component.

  • public float2 m_ResidentialDemandWeightsSelector
    A 2D selector/weight vector used when computing residential demand weights. The two components can represent two weighting parameters used by the demand algorithm (exact interpretation depends on consuming systems). Values are typically in the 0..1 range but may exceed 1 if the consumer treats them as scale factors.

  • public float m_CommercialTaxEffectDemandOffset
    A flat offset applied to commercial demand based on tax effects. Positive/negative values increase/decrease commercial demand independent of other multipliers.

  • public float m_IndustrialOfficeTaxEffectDemandOffset
    A flat offset applied to industrial and office demand from tax effects. Use to tune how tax changes influence industry/office demand.

  • public float m_ResourceDemandPerCitizenMultiplier
    Multiplier applied to per-citizen resource demand calculations (e.g., raw materials, goods). Values >1 increase demand per citizen; values <1 reduce it.

  • public float3 m_TaxPaidMultiplier
    Per-income/wealth-level multipliers applied to tax paid calculations. The three components commonly correspond to different wealth brackets or classes (low/medium/high) — check consuming systems for the exact mapping.

  • public bool m_SupportPoorCitizens
    When true, government-support logic for low-wealth citizens is enabled. Systems can use this to trigger subsidies, welfare, or other support mechanics.

  • public int m_MinimumWealth
    Minimum wealth level considered when applying certain wealth-dependent systems (for example eligibility thresholds for services or effects). Interpretation (absolute wealth value or index) depends on system implementation.

  • public bool m_EnableGovernmentSubsidies
    Toggle that enables/disables automatic government subsidies (e.g., for industries, services, or citizens). Systems should check this to determine whether to schedule/dispense subsidies.

  • public int2 m_MoneyCoverThreshold
    Two-int thresholds used by subsidy or money-cover logic. Typical usage patterns: x = lower threshold, y = upper threshold (or current/target), but consult consuming code for exact semantics. Values are currency amounts.

  • public int m_MaxMoneyCoverPercentage
    Maximum percentage (0–100) of a required cost that the government will cover via subsidies or money cover schemes.

  • public bool m_EnableAdjustNaturalResources
    When true, systems that adjust natural resource availability (initial boosts, refill rates) should be active. Useful to toggle resource manipulations per-mode.

  • public float m_InitialNaturalResourceBoostMultiplier
    Multiplier applied to initial natural resource yields/availability when the mode grants an initial boost. Values >1 increase initial resource availability.

  • public int m_PercentOreRefillAmountPerDay
    Daily refill percentage for ore deposits (expressed as an int percent). Used by resource-regeneration systems to increment ore resource by this percent per day.

  • public int m_PercentOilRefillAmountPerDay
    Daily refill percentage for oil deposits (expressed as an int percent). Used by resource-regeneration systems to increment oil resource by this percent per day.

Properties

This struct does not declare any C# properties. It's a plain data-only ECS component. Access and mutation are intended via EntityManager / System API (SetComponentData / GetComponentData / WithStore/WithChangeFilter patterns depending on Entities version).

Constructors

  • public ModeSettingData()
    Structs get a default (parameterless) constructor automatically provided by C#. When creating an instance explicitly, initialize all fields you rely on to avoid default-zero semantics that may be surprising (for example booleans default to false, numeric fields to 0).

Methods

This data struct declares no methods. All logic that consumes ModeSettingData should be implemented in ECS systems that read this component.

Usage Example

using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs.Modes;

// Create a singleton entity holding mode settings and initialize values
var em = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = em.CreateArchetype(typeof(ModeSettingData));
var modeEntity = em.CreateEntity(archetype);

var settings = new ModeSettingData {
    m_Enable = true,
    m_ResidentialDemandWeightsSelector = new float2(0.6f, 0.4f),
    m_CommercialTaxEffectDemandOffset = 0.05f,
    m_IndustrialOfficeTaxEffectDemandOffset = -0.02f,
    m_ResourceDemandPerCitizenMultiplier = 1.0f,
    m_TaxPaidMultiplier = new float3(0.9f, 1.0f, 1.2f),
    m_SupportPoorCitizens = true,
    m_MinimumWealth = 0,
    m_EnableGovernmentSubsidies = false,
    m_MoneyCoverThreshold = new int2(1000, 5000),
    m_MaxMoneyCoverPercentage = 50,
    m_EnableAdjustNaturalResources = true,
    m_InitialNaturalResourceBoostMultiplier = 1.25f,
    m_PercentOreRefillAmountPerDay = 1,
    m_PercentOilRefillAmountPerDay = 1
};

em.SetComponentData(modeEntity, settings);

Notes: - Because ModeSettingData implements IQueryTypeParameter, it can be used to influence query behavior in newer Entities APIs — consult the specific Entities version documentation in your mod environment. - Always verify how consuming systems interpret fields like int2 thresholds and float3 multipliers before making large gameplay changes.