Game.Prefabs.FeedbackConfigurationPrefab
Assembly:
Namespace: Game.Prefabs
Type: Class
Base: PrefabBase
Summary:
Prefab that provides global configuration for feedback (happy/sad icons and the numeric factors that control how various city systems affect citizen feedback). This prefab maps inspector-exposed fields to ECS components used at runtime: FeedbackConfigurationData and two dynamic buffers (FeedbackLocalEffectFactor and FeedbackCityEffectFactor). Use this prefab to tune how services, pollution, transport, education, etc., influence local and city-level feedback for modding or balancing.
Fields
-
public NotificationIconPrefab m_HappyFaceNotification
Reference to the notification icon prefab used when feedback is positive (happy). -
public NotificationIconPrefab m_SadFaceNotification
Reference to the notification icon prefab used when feedback is negative (sad). -
public float m_GarbageProducerGarbageFactor = 0.001f
Factor applied to garbage production from producers for feedback calculations. -
public float m_GarbageVehicleFactor = 0.1f
Factor applied to garbage vehicles (collection) in feedback. -
public float m_HospitalAmbulanceFactor = 0.01f
Weight for ambulance service impact on feedback. -
public float m_HospitalHelicopterFactor = 0.1f
Weight for hospital helicopter service impact on feedback. -
public float m_HospitalCapacityFactor = 0.001f
Factor for hospital capacity influence. -
public float m_DeathcareHearseFactor = 0.1f
Factor for hearse vehicles affecting feedback. -
public float m_DeathcareCapacityFactor = 0.0005f
Factor for deathcare capacity influence. -
public float m_DeathcareProcessingFactor = 0.05f
Factor for deathcare processing (throughput) effect. -
public float m_ElectricityConsumptionFactor = 0.01f
Factor for electricity consumption affecting feedback. -
public float m_ElectricityProductionFactor = 0.0001f
Factor for electricity production affecting feedback. -
public float m_TransformerRadius = 500f
Radius used for transformer-related local effects. -
public float m_WaterConsumptionFactor = 0.01f
Factor for water consumption influence. -
public float m_WaterCapacityFactor = 0.0001f
Factor for water capacity influence. -
public float m_WaterConsumerSewageFactor = 0.002f
Factor linking water consumers to sewage production for feedback. -
public float m_SewageCapacityFactor = 0.0001f
Factor for sewage capacity influence. -
public float m_TransportVehicleCapacityFactor = 0.01f
Factor for transport vehicle capacity impact. -
public float m_TransportDispatchCenterFactor = 0.005f
Factor for transport dispatch center influence. -
public float m_TransportStationRange = 1000f
Range used for transport station influence. -
public float m_TransportStopRange = 250f
Range used for individual stops influence. -
public float m_MailProducerMailFactor = 0.01f
Factor for mail production affecting feedback. -
public float m_PostFacilityVanFactor = 0.01f
Factor for post facility van vehicles. -
public float m_PostFacilityTruckFactor = 0.1f
Factor for post facility truck vehicles. -
public float m_PostFacilityCapacityFactor = 0.0001f
Factor for post facility capacity influence. -
public float m_PostFacilityProcessingFactor = 0.001f
Factor for post facility processing throughput. -
public float m_TelecomCapacityFactor = 0.0001f
Factor for telecom capacity influence. -
public float m_ElementarySchoolCapacityFactor = 0.002f
Factor for elementary school capacity effect on feedback. -
public float m_HighSchoolCapacityFactor = 0.001f
Factor for high school capacity effect. -
public float m_CollegeCapacityFactor = 0.0005f
Factor for college capacity effect. -
public float m_UniversityCapacityFactor = 0.0002f
Factor for university capacity effect. -
public float m_ParkingFacilityRange = 400f
Range used for parking facility influence. -
public float m_MaintenanceVehicleFactor = 0.02f
Factor for maintenance vehicles (roadworks, upkeep) on feedback. -
public float m_FireStationEngineFactor = 0.02f
Factor for fire engine vehicles' effect on feedback. -
public float m_FireStationHelicopterFactor = 0.02f
Factor for fire helicopter effect. -
public float m_CrimeProducerCrimeFactor = 0.0002f
Factor for crime-producing sources. -
public float m_PoliceStationCarFactor = 0.01f
Factor for police car influence on feedback. -
public float m_PoliceStationHelicopterFactor = 0.1f
Factor for police helicopter influence. -
public float m_PoliceStationCapacityFactor = 0.005f
Factor for police station capacity. -
public float m_PrisonVehicleFactor = 0.02f
Factor for prison-related vehicle influence. -
public float m_PrisonCapacityFactor = 0.0001f
Factor for prison capacity effect. -
public float m_GroundPollutionFactor = 0.01f
Weight for ground pollution effect on feedback. -
public float m_AirPollutionFactor = 0.01f
Weight for air pollution effect. -
public float m_NoisePollutionFactor = 0.01f
Weight for noise pollution effect. -
public float m_GroundPollutionRadius = 150f
Radius over which ground pollution is considered for local feedback. -
public float m_AirPollutionRadius = 1000f
Radius for air pollution influence. -
public float m_NoisePollutionRadius = 200f
Radius for noise pollution influence. -
public float m_AttractivenessFactor = 0.005f
Factor for attractiveness influence on feedback. -
[EnumValue(typeof(LocalModifierType))] public float[] m_LocalModifierFactors
Array of per-LocalModifierType factors. During LateInitialize each entry becomes a FeedbackLocalEffectFactor element in the prefab entity's dynamic buffer in the same order as the LocalModifierType enum. -
[EnumValue(typeof(CityModifierType))] public float[] m_CityModifierFactors
Array of per-CityModifierType factors. Filled into FeedbackCityEffectFactor dynamic buffer during LateInitialize, in enum order.
Properties
- None. (This prefab exposes fields only; the runtime representation is via ECS components.)
Constructors
public FeedbackConfigurationPrefab()
Default constructor (inherited behavior from PrefabBase). The class relies on inspector-serialized fields; no custom construction logic in code.
Methods
-
public override void GetDependencies(List<PrefabBase> prefabs)
Adds referenced prefabs (m_HappyFaceNotification and m_SadFaceNotification) to the provided dependency list so they are loaded/initialized before this prefab. -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Registers which ECS components are required by this prefab: FeedbackConfigurationData, FeedbackLocalEffectFactor (buffer), and FeedbackCityEffectFactor (buffer). Ensures the prefab entity has these components. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Core initialization: maps inspector fields into the FeedbackConfigurationData component on the prefab entity (including notification entity references resolved via PrefabSystem). Also populates the FeedbackLocalEffectFactor and FeedbackCityEffectFactor dynamic buffers from m_LocalModifierFactors and m_CityModifierFactors arrays respectively. If arrays are null they are skipped.
Behavior notes: - The notification prefab references are converted to Entity via PrefabSystem.GetEntity. - All scalar factor fields are copied directly to the FeedbackConfigurationData component. - Local/city modifier float arrays are written into corresponding dynamic buffers in the order of the enum types, and each buffer element stores a single float m_Factor.
Usage Example
// Example: read the runtime config from a prefab entity
var world = World.DefaultGameObjectInjectionWorld;
var em = world.EntityManager;
// 'prefabEntity' should be the entity produced for the FeedbackConfigurationPrefab (e.g. from PrefabSystem)
Entity prefabEntity = /* obtain prefab entity, e.g. PrefabSystem.GetEntity(feedbackPrefab) */;
// Read configuration component
FeedbackConfigurationData config = em.GetComponentData<FeedbackConfigurationData>(prefabEntity);
// Read local modifier buffer
DynamicBuffer<FeedbackLocalEffectFactor> localBuffer = em.GetBuffer<FeedbackLocalEffectFactor>(prefabEntity);
for (int i = 0; i < localBuffer.Length; i++)
{
float factor = localBuffer[i].m_Factor;
// use factor...
}
// Update a single scalar factor at runtime (example)
config.m_GroundPollutionFactor = 0.02f;
em.SetComponentData(prefabEntity, config);
Notes for modders: - Tuning these values affects how services, vehicles, pollution, and facilities influence citizen feedback and notifications in the game. Adjust with care and test for balance. - The mapping between array indices and modifier semantics follows the LocalModifierType and CityModifierType enums; ensure arrays are created with the correct ordering/length if constructing them manually.