Skip to content

Game.Buildings.PropertyOnMarket

Assembly: Assembly-CSharp.dll (game assembly)

Namespace: Game.Buildings

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary: This struct is a lightweight ECS component used to mark a building/property entity as being listed on the market and to store the asking rent value. It implements IComponentData so it can be attached to entities, IQueryTypeParameter for use in queries, and ISerializable to support the game's custom serialization. The single field m_AskingRent holds the asking rent amount as an integer (game internal currency units).


Fields

  • public int m_AskingRent This integer stores the asking rent for the property. If not assigned explicitly it defaults to 0. The value represents the asking rent in the game's internal currency unit (integer).

Properties

  • This type does not declare any properties.

Constructors

  • public PropertyOnMarket() Struct has the default parameterless constructor provided by C#. Use object initializer to set m_AskingRent when adding the component to an entity.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter Writes the m_AskingRent value to the provided writer. Used by the game's serialization system to persist this component's state.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader Reads an int from the provided reader into m_AskingRent. Used by the game's deserialization system to restore this component's state.

Usage Example

// Add the component to an entity and set asking rent
var marketComponent = new PropertyOnMarket { m_AskingRent = 1500 };
entityManager.AddComponentData(entity, marketComponent);

// Query entities that have the component (example using Entities.ForEach style)
Entities.ForEach((ref PropertyOnMarket market) =>
{
    // access or modify asking rent
    int currentAsk = market.m_AskingRent;
    market.m_AskingRent = currentAsk + 100; // adjust rent
});

// Serialization example (pseudo-usage with a writer/reader provided by the game's serialization)
var writer = /* obtain writer */;
marketComponent.Serialize(writer);

// Deserialization example
var reader = /* obtain reader */;
var loaded = new PropertyOnMarket();
loaded.Deserialize(reader);
// then attach loaded to entity if needed
entityManager.AddComponentData(entity, loaded);