Game.Triggers.ChirpEntity
Assembly:
Assembly-CSharp (most game types live in Assembly-CSharp)
Namespace:
Game.Triggers
Type:
struct ChirpEntity
Base:
IBufferElementData, ISerializable
Summary:
Represents a lightweight buffer element that holds a Unity.Entities.Entity reference used by chirp/trigger systems. The struct is marked with InternalBufferCapacity(2) to give the dynamic buffer a small inline capacity optimization. It implements Colossal.Serialization.Entities.ISerializable so the contained Entity reference can be written to and read from the game's save serialization system.
Fields
public Unity.Entities.Entity m_Entity
Holds the Entity reference stored by this buffer element. This is the data that will be written/read during save/load and is the value carried in the IBufferElementData buffer.
Properties
- None. This type exposes a public field rather than properties.
Constructors
public ChirpEntity(Unity.Entities.Entity entity)
Constructs a ChirpEntity and sets m_Entity to the provided entity reference.
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
Writes the contained Entity (m_Entity) to the provided writer. Used by the game's custom serialization pipeline to persist entity references. -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
Reads an Entity value from the provided reader into m_Entity. Used when loading saved data to restore the entity reference.
Usage Example
// Add a ChirpEntity to a dynamic buffer on a trigger entity
var buffer = entityManager.AddBuffer<Game.Triggers.ChirpEntity>(triggerEntity);
buffer.Add(new Game.Triggers.ChirpEntity(targetEntity));
// Read entries from the buffer
foreach (var chirpEntry in buffer)
{
Unity.Entities.Entity target = chirpEntry.m_Entity;
// use target (e.g., trigger a chirp effect on the entity)
}