Game.Prefabs.EmergencyRadioEvent
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
Represents a prefab component used to define an "Emergency Radio" event trigger in the game. This class is a ComponentBase-derived prefab definition that is expected to register the ECS component types required for the archetype and the prefab instance. In the provided source both registration methods are empty, so modders should implement GetArchetypeComponents and GetPrefabComponents to declare which Unity.Entities.ComponentType entries are required for this prefab to function at runtime.
This component is annotated with a ComponentMenu attribute so it appears under the "Triggers/" menu in the editor (associated with TriggerPrefab).
Fields
- None
This class declares no instance fields in the provided source.
Properties
- None
There are no properties declared on this class.
Constructors
public EmergencyRadioEvent()
Default parameterless constructor is generated implicitly. No special initialization is provided in the source.
Methods
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Called to populate the set of component types required by the ECS archetype for entities that will be created from this prefab. In the provided source the method body is empty — you should add required ComponentType entries here (for example trigger/behavior marker components, timing or audio components that must be present on the archetype). -
public override void GetPrefabComponents(HashSet<ComponentType> components)
Called to populate the set of component types that should be included on the prefab instance. This typically contains the components that hold data specific to this prefab (references, configuration values, audio/event IDs, etc.). The method is empty in the source and should be implemented to add appropriate ComponentType.Create() entries.
Additional notes:
- The class is decorated with [ComponentMenu("Triggers/", new Type[] { typeof(TriggerPrefab) })], which registers the prefab under the Triggers menu and associates it with TriggerPrefab.
- When adding ComponentType entries, use Unity.Entities.ComponentType.Create
Usage Example
// Example implementation adding hypothetical components required by this prefab.
// Replace the placeholder component types with the actual components used in your mod.
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
// Marker or behavior components that must exist on the archetype
components.Add(ComponentType.Create<TriggerMarkerComponent>());
components.Add(ComponentType.Create<EmergencyRadioBehavior>()); // example IComponentData
components.Add(ComponentType.Create<TransformComponent>());
}
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// Data components with prefab-specific configuration (audio id, radius, delay, etc.)
components.Add(ComponentType.Create<EmergencyRadioData>());
components.Add(ComponentType.Create<AudioEventReference>());
components.Add(ComponentType.Create<TriggerRadius>());
}
Tips: - Keep archetype components limited to those that are necessary on all instances; use prefab components for data that varies between prefabs. - If you rely on existing engine components (audio, timing, trigger systems), inspect their component types and add them here so the ECS systems can find the components they expect. - If you need to perform initialization at spawn time, implement runtime systems that read the components you declare here and perform setup logic.