Skip to content

Game.EvacuationRequest

Assembly:
Assembly-CSharp (game/mod assembly)

Namespace:
Game.Simulation

Type:
struct

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

Summary:
Represents an evacuation request component used in the game's ECS. It stores a target Entity that the evacuation is directed to and a floating-point priority value. The struct is serializable (implements ISerializable) so it can be written to/read from the game's serialization streams (saves, network, or other persistence). Typical usage is attaching this component to an entity to mark it as requesting evacuation or to schedule evacuation-related behavior in systems that query for EvacuationRequest components.


Fields

  • public Entity m_Target
    The destination or target Entity for the evacuation request. Systems consuming this component should interpret this Entity as the place to evacuate to (or the object/entity relevant to the evacuation request).

  • public float m_Priority
    A numerical priority indicating the importance or urgency of this evacuation request. Higher values typically denote higher priority; systems may use this to order or select requests when resources (vehicles, personnel) are limited.

Properties

  • None.
    This struct exposes its data via public fields rather than properties.

Constructors

  • public EvacuationRequest(Entity target, float priority)
    Creates a new EvacuationRequest with the specified target Entity and priority value.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter : System.Void
    Serializes this component by writing the m_Target Entity followed by the m_Priority float to the provided writer. Used during save/serialization phases.

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader : System.Void
    Deserializes the component by reading an Entity into m_Target and a float into m_Priority from the provided reader. Used during load/deserialization phases.

Usage Example

// Create and attach an EvacuationRequest to an entity (EntityManager usage)
Entity targetEntity = /* obtain target entity */;
float priority = 0.75f;
var request = new EvacuationRequest(targetEntity, priority);

// In an ECS system/context with an EntityManager:
Entity requesterEntity = /* entity that requests evacuation */;
entityManager.AddComponentData(requesterEntity, request);

// The component will be serialized automatically via its ISerializable implementation
// when the game triggers serialization. Custom serialization code can also call:
request.Serialize(customWriter);

// And during deserialization:
var deserialized = new EvacuationRequest();
deserialized.Deserialize(customReader);