Game.Prefabs.InfoviewLocalEffectData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
InfoviewLocalEffectData is a small ECS component that describes a local visual modifier for the game's infoview (UI/visualization). It encodes which modifier to apply (m_Type) and the color to use (m_Color). This component is intended to be attached to entities to drive localized visual effects in the infoview system (e.g., highlight overlays, colorized indicators). It is a plain data container with no behavior.
Fields
-
public LocalModifierType m_Type
This field stores the type of local modifier to apply. LocalModifierType is an enum declared in Game.Buildings and determines which visual effect or modifier logic should be used by systems that process this component. -
public float4 m_Color
RGBA color used for the effect. Uses Unity.Mathematics.float4 where the components typically represent red, green, blue, and alpha (0..1). Systems that render or apply the local effect should read this value for colorization.
Properties
- This type has no properties. It exposes two public fields and implements IComponentData and IQueryTypeParameter.
Constructors
public InfoviewLocalEffectData()
Default value-type constructor (implicit). When created via the default constructor or as an uninitialized struct, m_Type will be the enum default (usually zero) and m_Color will be (0,0,0,0). Use object initializer to set explicit values.
Example explicit construction:
var effect = new InfoviewLocalEffectData {
m_Type = LocalModifierType.SomeModifier, // set to a valid enum value from Game.Buildings
m_Color = new float4(1f, 0f, 0f, 1f) // opaque red
};
Methods
- This struct defines no methods. It is pure data for ECS.
Usage Example
using Unity.Entities;
using Unity.Mathematics;
using Game.Buildings;
using Game.Prefabs;
// Create an entity with the InfoviewLocalEffectData component
var archetype = entityManager.CreateArchetype(typeof(InfoviewLocalEffectData));
var entity = entityManager.CreateEntity(archetype);
entityManager.SetComponentData(entity, new InfoviewLocalEffectData {
m_Type = LocalModifierType.Highlight, // replace with an actual enum value
m_Color = new float4(0f, 1f, 0f, 0.8f) // semi-transparent green
});
// Example of reading the component in a system
public partial class InfoviewEffectSystem : SystemBase
{
protected override void OnUpdate()
{
Entities.ForEach((ref InfoviewLocalEffectData effect) =>
{
// Apply or queue visual changes based on effect.m_Type and effect.m_Color
// (Rendering/visual application implementation lives elsewhere)
}).ScheduleParallel();
}
}
Notes: - This component is intended for use by systems that interpret LocalModifierType and apply visual changes accordingly. It does not itself perform rendering. - float4 uses Unity.Mathematics; ensure the consuming systems convert or use the color in the desired color space/format.