Game.Prefabs.AttractivenessParameterData
Assembly: Assembly-CSharp (game/mod main assembly)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType
Implements: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
Component data that groups parameters used to compute tile/building attractiveness based on environment factors. Contains tunable multipliers and ranges for forest and shore effects, height-based bonuses, temperature influence, and precipitation (rain/snow) related effects. Systems that evaluate attractiveness or environment-driven modifiers read this component to influence simulation and expression of attractiveness.
Fields
-
public float m_ForestEffect
Controls the magnitude of attractiveness contributed by nearby forest. Typical multiplier applied to forest coverage. -
public float m_ForestDistance
Distance (in world units) over which forest contributes to attractiveness. Values beyond this distance have reduced or no effect. -
public float m_ShoreEffect
Magnitude of attractiveness contributed by proximity to shore/water. -
public float m_ShoreDistance
Distance (in world units) over which shore proximity contributes to attractiveness. -
public float3 m_HeightBonus
Height-related bonuses (x/y/z can represent different tiers or a curve sample) applied based on terrain height; used to give extra attractiveness at specific altitude ranges. -
public float2 m_AttractiveTemperature
Preferred temperature range (min, max) that increases attractiveness when the local temperature falls within this range. -
public float2 m_ExtremeTemperature
Extreme temperature thresholds (min, max) beyond which attractiveness is negatively affected. -
public float2 m_TemperatureAffect
Magnitudes of temperature influence (e.g., positive/negative multipliers) applied when temperature is within preferred or extreme ranges. -
public float2 m_RainEffectRange
Range values controlling how rain intensity affects attractiveness (min, max influence thresholds). -
public float2 m_SnowEffectRange
Range values controlling how snow intensity affects attractiveness (min, max influence thresholds). -
public float3 m_SnowRainExtremeAffect
Additional multipliers or modifiers (per-component) applied when precipitation reaches extreme levels (used to penalize attractiveness under severe conditions).
Properties
- This struct exposes no C# properties; it contains only public fields and implements IComponentData / IQueryTypeParameter.
Constructors
public AttractivenessParameterData()
No explicit constructors are defined; the default parameterless struct constructor is used. Initialize fields by assignment when creating the component.
Methods
- This struct defines no methods. It is a plain data container used by ECS systems.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Prefabs;
// Create an entity and attach the AttractivenessParameterData component with example values
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var archetype = entityManager.CreateArchetype(typeof(AttractivenessParameterData));
var entity = entityManager.CreateEntity(archetype);
var attractiveness = new AttractivenessParameterData
{
m_ForestEffect = 1.2f,
m_ForestDistance = 50f,
m_ShoreEffect = 1.5f,
m_ShoreDistance = 30f,
m_HeightBonus = new float3(0.0f, 0.2f, 0.5f),
m_AttractiveTemperature = new float2(18f, 26f),
m_ExtremeTemperature = new float2(-10f, 40f),
m_TemperatureAffect = new float2(0.8f, 0.5f),
m_RainEffectRange = new float2(0f, 1f),
m_SnowEffectRange = new float2(0f, 1f),
m_SnowRainExtremeAffect = new float3(0.0f, -0.3f, -0.6f)
};
entityManager.SetComponentData(entity, attractiveness);