Game.Prefabs.SpectatorEventData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType (implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter)
Summary:
SpectatorEventData is a plain ECS component (data-only struct) used to configure "spectator" events in the game. It specifies which type of site(s) the event should target and the durations (in seconds) for the event lifecycle phases: preparation, active, and termination. This component is intended to be attached to entities so systems can schedule and drive spectator-style events.
Fields
-
public EventTargetType m_RandomSiteType
Specifies the kind of site the spectator event should select/target. This is typically an enum that describes available site categories (e.g., landmarks, parks, custom event sites). Systems reading this component will use this value to choose a suitable site for the event. -
public float m_PreparationDuration
Duration (in seconds) of the preparation phase before the event becomes active. Use this to control lead-in time (e.g., crowd gathering, setup animations). -
public float m_ActiveDuration
Duration (in seconds) for which the event is considered active. Controls how long the main event runs (e.g., time spectators remain engaged). -
public float m_TerminationDuration
Duration (in seconds) of the termination/teardown phase after the event ends (e.g., dispersal, cleanup).
Properties
- This type has no properties. It is a plain IComponentData struct exposing fields directly.
Constructors
public SpectatorEventData()
The default parameterless constructor is provided by the struct type. Initialize fields directly or via an object initializer when creating instances. No custom constructors are defined in the source.
Methods
- This struct defines no methods. It is a data-only component; all behavior should be implemented in ECS systems reading/writing this component.
Usage Example
// Example: create and attach SpectatorEventData to an entity using EntityManager
var spectatorData = new SpectatorEventData
{
m_RandomSiteType = EventTargetType.SomeSiteType, // replace with a concrete enum value
m_PreparationDuration = 5f, // seconds
m_ActiveDuration = 12f, // seconds
m_TerminationDuration = 3f // seconds
};
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
entityManager.AddComponentData(someEntity, spectatorData);
// Example usage inside a SystemBase to read/update the component:
Entities
.WithAll<SpectatorEventData>()
.ForEach((ref SpectatorEventData ev) =>
{
// Systems can read ev.m_RandomSiteType and the durations to drive event state machines.
}).Schedule();