Skip to content

Game.HandleRequest

Assembly:
Game (Assembly-CSharp / Game assembly)

Namespace:
Game.Simulation

Type:
struct

Base:
System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents a request-handling relationship between two entities in the ECS: a request entity and the entity currently handling that request. This struct is intended to be used as a component (IComponentData) and as a query type parameter (IQueryTypeParameter) to find or operate on request/handler pairs. It carries flags indicating whether the request has been completed and whether a path (or similar resource) has been consumed as part of handling.


Fields

  • public Entity m_Request
    Entity that originated the request (the request entity). Use this to identify which request is being processed.

  • public Entity m_Handler
    Entity that is handling the request (the handler/worker entity). Use this to identify or contact the handler.

  • public bool m_Completed
    True when the request handling is finished. Systems can check and react to completed requests (cleanup, reward, state transition, etc).

  • public bool m_PathConsumed
    Flag indicating whether an associated path (or another consumable resource used while handling the request) has been consumed. Useful to prevent double-consuming resources or to control further processing.

Properties

  • None. (This struct exposes only public fields and implements IComponentData/IQueryTypeParameter.)

Constructors

  • public HandleRequest(Entity request, Entity handler, bool completed, bool pathConsumed = false)
    Creates a new HandleRequest component instance. Provide the request and handler entities and initial flags. The pathConsumed parameter defaults to false.

Methods

  • None. This is a simple data container / component type.

Usage Example

// Create and attach a HandleRequest component to a handler entity:
var requestEntity = /* an Entity representing the request */;
var handlerEntity = /* an Entity representing the handler */;
var handleRequest = new HandleRequest(requestEntity, handlerEntity, completed: false);

// Using EntityManager (or in a SystemBase with EntityManager access)
EntityManager.AddComponentData(handlerEntity, handleRequest);

// Example SystemBase usage: query handlers and react when completed
Entities.ForEach((Entity handlerEnt, ref HandleRequest handle) =>
{
    if (handle.m_Completed)
    {
        // do cleanup: remove component, notify requester, etc.
        EntityManager.RemoveComponent<HandleRequest>(handlerEnt);
    }
}).WithoutBurst().Run();