Skip to content

Game.Prefabs.EffectRangeInfomodePrefab

Assembly:
Assembly-CSharp (typical Unity game assembly)

Namespace:
Game.Prefabs

Type:
class

Base:
ColorInfomodeBasePrefab

Summary:
EffectRangeInfomodePrefab is a prefab class used by the infomode system to display a local-effect radius (an effect range) in the game's infoview. It exposes a LocalModifierType that determines which local modifier/effect is visualized and, on initialization, writes an InfoviewLocalEffectData component to the entity containing that type and the prefab color. The prefab is decorated with a ComponentMenu attribute so it appears under "Tools/Infomode/" in Unity's component menu.


Fields

  • public LocalModifierType m_Type
    Holds the local modifier/effect type that this infomode prefab represents. When the prefab is initialized into an entity, this value is copied into the InfoviewLocalEffectData component so the infoview system knows which effect radius to render.

Properties

  • public override string infomodeTypeLocaleKey { get; }
    Returns the localization key for the infomode type label shown in the UI. This prefab overrides the value to "Radius", indicating the label displayed for this infomode is the localized string for "Radius".

Constructors

  • public EffectRangeInfomodePrefab()
    Default constructor. Standard Unity/MonoBehaviour-style prefab constructor (no custom construction logic present in the class).

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds required ECS component types to the provided set. This override calls the base implementation and then adds InfoviewLocalEffectData (read/write) so that entities created from this prefab include that component.

  • public override void Initialize(EntityManager entityManager, Entity entity)
    Initializes an entity created from this prefab. Calls the base Initialize, then sets the InfoviewLocalEffectData component on the entity with:

  • m_Type set from this prefab's m_Type field
  • m_Color set from the prefab color (m_Color is provided by the ColorInfomodeBasePrefab base class and converted to a float4)

Usage Example

// Example of how this prefab initializes entity data.
// The prefab itself sets the type and color during Initialize().
[ComponentMenu("Tools/Infomode/")]
public class EffectRangeInfomodePrefab : ColorInfomodeBasePrefab
{
    public LocalModifierType m_Type;

    public override string infomodeTypeLocaleKey => "Radius";

    public override void GetPrefabComponents(HashSet<ComponentType> components)
    {
        base.GetPrefabComponents(components);
        components.Add(ComponentType.ReadWrite<InfoviewLocalEffectData>());
    }

    public override void Initialize(EntityManager entityManager, Entity entity)
    {
        base.Initialize(entityManager, entity);
        entityManager.SetComponentData(entity, new InfoviewLocalEffectData
        {
            m_Type = m_Type,
            m_Color = new Unity.Mathematics.float4(m_Color.r, m_Color.g, m_Color.b, m_Color.a)
        });
    }
}

Notes: - This prefab depends on the InfoviewLocalEffectData ECS component and the ColorInfomodeBasePrefab base class (which provides m_Color and shared infomode behavior). - Assembly name is assumed to be the default Unity Assembly-CSharp; change if your project uses a different assembly.