Skip to content

Game.Prefabs.LotData

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
LotData is an ECS component that stores configuration for a "lot" prefab: maximum radius, display color for its range, and flags indicating whether it sits on water and whether it may overlap other lots. It implements Colossal.Serialization.Entities.ISerializable so it can be written/read with the game's serialization API. Note: the implementation only serializes m_MaxRadius and m_OnWater — m_RangeColor and m_AllowOverlap are not written/read by the current Serialize/Deserialize methods, so they will be lost across serialization unless handled elsewhere.


Fields

  • public System.Single m_MaxRadius
    Maximum radius of the lot (float).

  • public UnityEngine.Color32 m_RangeColor
    Color used to render the lot's range. Not serialized by the provided methods.

  • public System.Boolean m_OnWater
    Flag indicating whether the lot is placed on water. This value is serialized.

  • public System.Boolean m_AllowOverlap
    Flag that allows overlapping with other lots. Not serialized by the provided methods.

Properties

  • None

Constructors

  • public LotData(float maxRadius, Color32 rangeColor, bool onWater, bool allowOverlap)
    Creates a LotData instance with the supplied values. As a struct it also has the implicit default constructor (fields default-initialized).

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the component to a writer. Current implementation writes:
  • m_MaxRadius (float)
  • m_OnWater (bool) Note: m_RangeColor and m_AllowOverlap are intentionally not written here.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads data from a reader into the component. Current implementation reads:

  • m_MaxRadius (float)
  • m_OnWater (bool) Again, m_RangeColor and m_AllowOverlap are not read and will remain default unless set elsewhere.

Implementation details: Serialize/Deserialize are generic over IWriter/IReader types provided by the Colossal.Serialization.Entities API. The code uses local refs in Deserialize to assign into struct fields.

Usage Example

// Constructing and using LotData as a component
var lot = new Game.Prefabs.LotData(
    maxRadius: 12.5f,
    rangeColor: new Color32(255, 200, 100, 255),
    onWater: false,
    allowOverlap: true
);

// Add to an entity with the ECS EntityManager (example)
EntityManager entityManager = /* obtain EntityManager */;
Entity myLotEntity = /* create or obtain entity */;
entityManager.AddComponentData(myLotEntity, lot);

// Example pseudo-serialization (actual writer type depends on game APIs)
IWriter writer = /* obtain writer from serialization context */;
lot.Serialize(writer);

// Example pseudo-deserialization
IReader reader = /* obtain reader from serialization context */;
var loadedLot = new Game.Prefabs.LotData();
loadedLot.Deserialize(reader);
// Note: loadedLot.m_RangeColor and loadedLot.m_AllowOverlap will be default
// unless the calling code sets them after deserialization.