Game.Buildings.Lot
Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Buildings
Type: struct
Base: Implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter, Colossal.Serialization.Entities.IEmptySerializable
Summary: Lot is a small ECS component used by the buildings/placement systems to store sampled height information for each side of a building lot. Each side (front, right, back, left) stores three height samples in a Unity.Mathematics.float3. These sample points are typically used for placement, leveling, slope calculations, and mesh/footprint adaptation to terrain or neighbouring lots. The component is serializable via the game's Colossal serialization interfaces and is intended to be attached to building/lot entities in the ECS world.
Fields
-
public float3 m_FrontHeights
Stores three sampled terrain heights along the front edge of the lot (ordered consistently along that edge, e.g., left→right). Used to evaluate the front-side elevation when placing or aligning building geometry. -
public float3 m_RightHeights
Stores three sampled terrain heights along the right edge of the lot (ordered consistently along that edge). Used for right-side elevation and slope calculations. -
public float3 m_BackHeights
Stores three sampled terrain heights along the back edge of the lot. Used for back-side elevation and related placement decisions. -
public float3 m_LeftHeights
Stores three sampled terrain heights along the left edge of the lot. Used for left-side elevation and slope handling.
Properties
- None
This struct exposes no C# properties; its data is stored directly in public fields for direct ECS access and efficient serialization.
Constructors
public Lot()
The default parameterless struct constructor is used (implicit). All float3 fields default to float3(0f, 0f, 0f) unless explicitly initialized.
Methods
- None
This component is a pure data container (IComponentData). Behaviour and computations are expected to be implemented in systems that read/update this component.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Buildings;
// Create and initialize a Lot component, then add it to an entity.
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity(); // or obtain an existing lot entity
var lot = new Lot
{
// Example: sample heights at three points along each side (units in world Y)
m_FrontHeights = new float3(12.0f, 12.2f, 12.1f),
m_RightHeights = new float3(12.1f, 12.3f, 12.4f),
m_BackHeights = new float3(11.9f, 12.0f, 12.2f),
m_LeftHeights = new float3(12.0f, 11.8f, 11.9f)
};
entityManager.AddComponentData(entity, lot);
// Later, in a system, read and use the heights to compute leveling/slope:
var fetchedLot = entityManager.GetComponentData<Lot>(entity);
float frontAvg = math.csum(fetchedLot.m_FrontHeights) / 3f;
Additional notes and modding tips: - The meaning of "front/right/back/left" follows the lot's local/oriented coordinate system used by the building placement systems — verify orientation when interpreting which side faces a road or neighbour. - Use Unity.Mathematics operations (math.csum, math.max, math.min, etc.) for efficient SIMD-friendly computations. - Because this is an IComponentData, prefer reading/writing it inside ECS systems (Jobs or main-thread systems) rather than in random MonoBehaviours to preserve performance and determinism. - The IEmptySerializable marker indicates compatibility with the game's Colossal serialization pipeline; ensure any custom serialization expectations are followed when modifying or extending this component.