Game.Simulation.ElectricityValveConnection
Assembly: Assembly-CSharp
Namespace: Game.Simulation
Type: struct
Base: IComponentData, IQueryTypeParameter, ISerializable
Summary:
Represents an ECS component that stores a reference to an electricity valve node entity. This component is intended for use in the game's entity-component-system (ECS) to link entities that participate in the electricity/valve simulation. It also implements serialization so the connection can be saved and loaded as part of entity data.
Fields
public Unity.Entities.Entity m_ValveNode
Holds the target valve nodeEntity
that this connection points to. May beEntity.Null
if no connection is present. Used by systems that traverse or update electricity valves to find connected nodes.
Properties
- None.
This struct exposes no managed properties; it is a plain data component with a single public field.
Constructors
public ElectricityValveConnection()
Default (implicit) value-type constructor. Initializesm_ValveNode
toEntity.Null
by default when the struct is created without explicit values.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
ImplementsISerializable.Serialize
. Writes them_ValveNode
entity reference using the provided writer. Used when saving entity data. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
ImplementsISerializable.Deserialize
. Reads them_ValveNode
entity reference from the provided reader. Used when loading entity data.
Usage Example
// Add or update the component on an entity to point to a valve node:
var connection = new ElectricityValveConnection { m_ValveNode = targetValveEntity };
entityManager.SetComponentData(someEntity, connection);
// Example of how the struct's serialization methods are used by a serializer:
// serializer will call Serialize/Deserialize via the ISerializable interface