Skip to content

Game.Simulation.FloodCounterData

Assembly: Assembly-CSharp
Namespace: Game.Simulation

Type: struct

Base: System.ValueType, implements IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents a simple ECS component that stores a floating flood counter for an entity used by the game's flood simulation systems. The component is serializable via the provided ISerializable implementation and can be used as a query parameter (IQueryTypeParameter) in Entity queries. Typically the counter is used to track accumulated flood amount, duration, or progression for flood-related logic; its semantics depend on the systems that read and modify it.


Fields

  • public System.Single m_FloodCounter
    Stores the flood counter value for the entity. Default value for a new struct is 0.0f. Systems can read and modify this value to represent flood magnitude, elapsed flood time, or similar flood-related state. Use EntityManager.SetComponentData / GetComponentData to write/read this field at runtime.

Properties

  • This type defines no properties. It exposes a public field instead.

Constructors

  • public FloodCounterData()
    No explicit constructors are defined in the source; the default parameterless struct constructor initializes m_FloodCounter to 0.0f.

Methods

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the flood counter value from a serialized stream using the provided reader. Calls reader.Read(out m_FloodCounter) to populate the field. Used when loading/syncing entity state.

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the flood counter value to a serialized stream using the provided writer. Calls writer.Write(m_FloodCounter). Used when saving/syncing entity state.

Usage Example

// Create an entity with the FloodCounterData component and initialize the counter.
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
var entity = entityManager.CreateEntity(typeof(Game.Simulation.FloodCounterData));
entityManager.SetComponentData(entity, new Game.Simulation.FloodCounterData { m_FloodCounter = 0f });

// Read and update the counter in a system:
var counter = entityManager.GetComponentData<Game.Simulation.FloodCounterData>(entity);
counter.m_FloodCounter += 1.5f; // example increment
entityManager.SetComponentData(entity, counter);

// During serialization the component's Serialize/Deserialize are used by the
// game's custom serializer infrastructure to persist or sync the float value.