Skip to content

Game.EarlyDisasterWarningSystem

Assembly:
Assembly-CSharp (game code / modding assembly)

Namespace:
Game.Prefabs

Type:
class

Base:
ComponentBase

Summary:
A prefab component used by building prefabs that instructs the ECS archetype to include the runtime component Game.Buildings.EarlyDisasterWarningSystem. This class is decorated with a ComponentMenu attribute so it can be added to BuildingPrefab and BuildingExtensionPrefab assets from the editor under "Buildings/CityServices/". It does not contain runtime logic itself — it only contributes component types to prefab/archetype construction.


Fields

  • None
    This class defines no private or public fields.

Properties

  • None
    There are no properties declared on this component.

Constructors

  • public EarlyDisasterWarningSystem()
    Default parameterless constructor is provided implicitly. No special initialization is performed.

Methods

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    This method is intended to add component types that should be attached to the prefab entity when the prefab is instantiated. In this implementation the method body is empty — the prefab-level component set is not modified here.

  • public override void GetArchetypeComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Adds ComponentType.ReadWrite<Game.Buildings.EarlyDisasterWarningSystem>() to the provided set. This ensures that entities created from prefabs that include this ComponentBase will have a read/write ECS component of type Game.Buildings.EarlyDisasterWarningSystem in their archetype.

Additional notes: - The use of ComponentType.ReadWrite() indicates the ECS component will be writeable by systems. - This class is primarily a "tag/bridge" used at prefab/archetype construction time to pull the corresponding runtime component into the entity archetype.

Usage Example

[ComponentMenu("Buildings/CityServices/", new Type[]
{
    typeof(BuildingPrefab),
    typeof(BuildingExtensionPrefab)
})]
public class EarlyDisasterWarningSystem : ComponentBase
{
    // When building prefabs are converted to entities, this will ensure the
    // ECS component Game.Buildings.EarlyDisasterWarningSystem is included
    // in the entity archetype:
    public override void GetArchetypeComponents(HashSet<ComponentType> components)
    {
        components.Add(ComponentType.ReadWrite<Game.Buildings.EarlyDisasterWarningSystem>());
    }
}

Practical use: - Attach this ComponentBase to a BuildingPrefab or BuildingExtensionPrefab in a mod or in custom asset definitions to ensure the instantiated building entities contain the EarlyDisasterWarningSystem ECS component, enabling systems that operate on Game.Buildings.EarlyDisasterWarningSystem to find and process those entities.