Game.Creatures.ResetTrip
Assembly: Assembly-CSharp
Namespace: Game.Creatures
Type: struct
Base: IComponentData, IQueryTypeParameter
Summary: ResetTrip is a plain ECS component used to hold state for resetting or re-routing a creature's current trip. It stores references to the creature entity and various waypoint/target entities, associated resources and travel data, timing (delay), purpose enums, and a flag indicating whether a divert path exists. As an IQueryTypeParameter it is intended to be used in queries and systems operating on creature/trip logic (e.g., when interrupting, diverting, or restarting trips).
Fields
-
public Entity m_Creature
An Entity reference to the creature (citizen/pawn) whose trip is being reset. -
public Entity m_Source
Entity representing the source/starting waypoint of the trip. -
public Entity m_Target
Entity representing the primary target/destination of the trip. -
public Entity m_DivertTarget
Entity representing an alternate/divert destination (used when a trip is redirected). -
public Entity m_NextTarget
Entity representing the next waypoint/target after the current one (for multi-leg trips). -
public Entity m_Arrived
Entity used to indicate arrival status or an arrived-at node (often set when the creature reaches a target). -
public Resource m_TravelResource
Resource (from Game.Economy) associated with the travel to the primary target (e.g., ticket, fare, transport resource). -
public Resource m_DivertResource
Resource associated with the divert route/target. -
public Resource m_NextResource
Resource associated with the next target/leg of the trip. -
public ResidentFlags m_ResidentFlags
Flags that describe resident/citizen-specific options or statuses relevant to the trip (e.g., home/work flags, availability). -
public int m_TravelData
Integer data associated with m_TravelResource or travel to the primary target (can encode route index, cost, or custom metadata). -
public int m_DivertData
Integer data associated with the divert route/target. -
public int m_NextData
Integer data associated with the next target/leg. -
public uint m_Delay
Unsigned int representing a delay (in ticks/frames/time units) before the reset or next action is processed. -
public Purpose m_TravelPurpose
Purpose enum describing the reason or purpose for traveling to the primary target (e.g., Work, Leisure, Shopping). -
public Purpose m_DivertPurpose
Purpose enum for the divert target. -
public Purpose m_NextPurpose
Purpose enum for the next target/leg. -
public bool m_HasDivertPath
Boolean indicating whether a valid divert path exists (true if a divert route is available).
Properties
- None.
ResetTrip is a plain data struct (IComponentData) and exposes only public fields for storage. It does not define C# properties.
Constructors
public ResetTrip()
Structs have an implicit default constructor. Initialize using object initializer syntax or by assigning to fields after construction. There are no explicit constructors defined in code.
Methods
- None.
This type contains only data fields and no methods. All behavior is implemented by ECS systems that read or write this component.
Usage Example
using Unity.Entities;
using Game.Creatures;
using Game.Citizens;
using Game.Economy;
// Example: adding a ResetTrip component to an entity in a system or initialization code
public void AddResetTrip(EntityManager entityManager, Entity creatureEntity, Entity source, Entity target)
{
var reset = new ResetTrip
{
m_Creature = creatureEntity,
m_Source = source,
m_Target = target,
m_DivertTarget = Entity.Null,
m_NextTarget = Entity.Null,
m_Arrived = Entity.Null,
// Resource and purpose values depend on your game's types/enums:
m_TravelResource = default, // set appropriate Resource value
m_DivertResource = default,
m_NextResource = default,
m_ResidentFlags = default, // set appropriate ResidentFlags
m_TravelData = 0,
m_DivertData = 0,
m_NextData = 0,
m_Delay = 0,
m_TravelPurpose = default, // set Purpose enum (e.g., Purpose.Work)
m_DivertPurpose = default,
m_NextPurpose = default,
m_HasDivertPath = false
};
entityManager.AddComponentData(creatureEntity, reset);
}
Notes: - This component is intended to be used by systems that manage creature trips, diversions, arrival handling, and trip resets. Systems will read and modify the fields to implement behavior. - Types like Resource, Purpose, and ResidentFlags come from Game.Economy and Game.Citizens namespaces; use appropriate enum/constant values according to the game's definitions.