Skip to content

Game.Prefabs.Modes.OutsideTradeParametersMode

Assembly:
(Assembly not present in file — likely Game or Assembly-CSharp)
Namespace: Game.Prefabs.Modes

Type: class

Base: EntityQueryModePrefab

Summary:
Mode prefab that exposes a set of parameters controlling outside-trade behavior (prices, multipliers, service import fees and population trade ranges). When applied, it writes these values into the singleton OutsideTradeParameterData component so the runtime systems use the configured parameters. The prefab also supports restoring defaults from the corresponding OutsideTradeParameterPrefab via PrefabSystem.


Fields

  • public float m_ElectricityImportPrice
    Controls the import price for electricity when trading with outside connections.

  • public float m_ElectricityExportPrice
    Controls the export price for electricity when trading with outside connections.

  • public float m_WaterImportPrice
    Import price for water.

  • public float m_WaterExportPrice
    Export price for water.

  • public float m_WaterExportPollutionTolerance
    Tolerance value used for water export in relation to pollution (game-specific semantics).

  • public float m_SewageExportPrice
    Export price for sewage.

  • public float m_AirWeightMultiplierOverridden
    Overridden weight multiplier for air transport when trading with outside.

  • public float m_RoadWeightMultiplierOverridden
    Overridden weight multiplier for road transport.

  • public float m_TrainWeightMultiplierOverridden
    Overridden weight multiplier for trains.

  • public float m_ShipWeightMultiplierOverridden
    Overridden weight multiplier for ships.

  • public float m_AirDistanceMultiplierOverridden
    Overridden distance multiplier for air transport.

  • public float m_RoadDistanceMultiplierOverridden
    Overridden distance multiplier for road transport.

  • public float m_TrainDistanceMultiplierOverridden
    Overridden distance multiplier for trains.

  • public float m_ShipDistanceMultiplierOverridden
    Overridden distance multiplier for ships.

  • public float m_AmbulanceImportServiceFee
    Import service fee applied for ambulances from outside.

  • public float m_HearseImportServiceFee
    Import service fee for hearses.

  • public float m_FireEngineImportServiceFee
    Import service fee for fire engines.

  • public float m_GarbageImportServiceFee
    Import service fee for garbage trucks.

  • public float m_PoliceImportServiceFee
    Import service fee for police vehicles.

  • public int m_OCServiceTradePopulationRange
    Population range used for "OC service trade" (game-specific semantics).

Properties

  • (none declared on this class)

Constructors

  • public OutsideTradeParametersMode()
    Default constructor — none explicitly defined in source, so the compiler-generated default is used.

Methods

  • public override EntityQueryDesc GetEntityQueryDesc() : EntityQueryDesc
    Returns an EntityQueryDesc that targets entities with the OutsideTradeParameterData component. Used by the mode system to find the singleton entity that stores outside-trade parameters.

  • protected override void RecordChanges(EntityManager entityManager, Entity entity) : void
    Called to record that the mode expects to change the OutsideTradeParameterData component. The implementation reads GetComponentData(entity) (likely to mark a read for change tracking).

  • public override JobHandle ApplyModeData(EntityManager entityManager, EntityQuery requestedQuery, JobHandle deps) : JobHandle
    Applies the prefab's values to the runtime singleton entity:

  • Locates the singleton entity via requestedQuery.GetSingletonEntity().
  • Reads the current OutsideTradeParameterData, updates all fields with the corresponding m_* values from the prefab, and writes the component back to the entity via entityManager.SetComponentData(...).
  • Returns the input deps unchanged (no jobs scheduled here).

  • public override void RestoreDefaultData(EntityManager entityManager, ref NativeArray<Entity> entities, PrefabSystem prefabSystem) : void
    Restores default values from the editor prefab:

  • Uses the first entity in the passed entities array.
  • Fetches the OutsideTradeParameterPrefab from PrefabSystem for that entity.
  • Copies values from the OutsideTradeParameterPrefab into the entity's OutsideTradeParameterData component and writes it back via entityManager.SetComponentData(...).

Usage Example

// Example: applying mode values to the runtime singleton from code.
// Typically the mode system calls ApplyModeData; this shows the core usage.

public void ApplyOutsideTradeMode(OutsideTradeParametersMode modePrefab, EntityManager em, EntityQuery query)
{
    // modePrefab fields are set in the prefab asset (or modified at runtime)
    // The game mode system would call:
    modePrefab.ApplyModeData(em, query, default);
}

Notes: - This class depends on the component type OutsideTradeParameterData and the prefab type OutsideTradeParameterPrefab. Both must exist and match the fields referenced here. - The mode writes directly to the singleton component; no asynchronous jobs are created by ApplyModeData (it returns the incoming JobHandle).