Skip to content

Game.Prefabs.RadioNewsEvent

Assembly:
Assembly-CSharp.dll

Namespace: Game.Prefabs

Type:
class

Base:
ComponentBase

Summary:
RadioNewsEvent is a prefab component used to define a "radio news" trigger prefab in the game. It is annotated with a ComponentMenu attribute so it appears under the Triggers menu in the editor and is associated with TriggerPrefab and StatisticTriggerPrefab types. The class provides override hooks to supply ECS component types for both the entity archetype and the runtime prefab entity when the prefab is converted to an ECS entity, but the default implementation in this file is empty and intended to be filled in by the modder or game's prefab conversion pipeline.


Fields

  • (none)
    This class declares no instance fields. All functionality is provided by overriding methods on the ComponentBase.

Properties

  • (none)
    No public properties are defined on this class.

Constructors

  • public RadioNewsEvent()
    The class uses the default parameterless constructor (implicit). No custom construction logic is defined.

Methods

  • public override void GetArchetypeComponents(HashSet<ComponentType> components)
    This method is called when building the ECS entity archetype for the prefab. Implementations should add ComponentType entries to the provided set to indicate which components should be present on the runtime entities' archetype (e.g., marker components, shared components, or data components used by systems). The method body is empty in this file and should be filled with the components required by the radio news trigger.

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    This method is called when converting a prefab into an ECS prefab entity. It should add any ComponentType entries that are specific to the prefab instance (for example, components containing default values or prefab-only markers). As with GetArchetypeComponents, the current implementation is empty and intended to be implemented to match the mod/game requirements.

Notes: - Typical implementations will call components.Add(ComponentType.ReadWrite()) or ComponentType.ReadOnly() for the data types that systems will operate on. - The ComponentMenu attribute on the class indicates relationship/intent: this prefab is part of the Triggers category and conceptually related to TriggerPrefab and StatisticTriggerPrefab types.

Usage Example

// Example implementation adding archetype and prefab components for a radio news trigger
public override void GetArchetypeComponents(HashSet<ComponentType> components)
{
    // Add marker/data components required on all runtime entities of this type
    components.Add(ComponentType.ReadWrite<TriggerComponent>());
    components.Add(ComponentType.ReadWrite<RadioNewsData>());
}

public override void GetPrefabComponents(HashSet<ComponentType> components)
{
    // Add prefab-only components or initial default data components
    components.Add(ComponentType.ReadWrite<PrefabReference>());
    components.Add(ComponentType.ReadWrite<StatisticTriggerPrefab>());
}