Game.Prefabs.ObjectStatusInfomodePrefab
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: class
Base: GradientInfomodeBasePrefab
Summary:
Prefab that represents an "object status" infomode. This prefab exposes an ObjectStatusType and a Bounds1 range which are written into an InfoviewObjectStatusData component on the entity. It is intended to provide data for infomode visualization (e.g., show object health/damage/status within a range). The class is also annotated with a ComponentMenu so it can be placed/selected in the editor under Tools/Infomode.
Fields
-
public ObjectStatusType m_Type
This field selects which object status to visualize (enum). The value is copied into the InfoviewObjectStatusData component during initialization. Typical uses: choose what metric to show for the infomode (damage, maintenance state, etc.). -
public Bounds1 m_Range
Defines the range/extent used by the infomode (type Bounds1 is used throughout the game to represent a 1D or area bound depending on context). The value is copied into the InfoviewObjectStatusData component and determines the area of effect / sampling range for the visualization.
Properties
- (none)
Constructors
public ObjectStatusInfomodePrefab()
No explicit constructor is defined in the source; the class uses the implicit public parameterless constructor. Initialization of runtime data for entities is performed in the overridden Initialize method rather than in a constructor.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the component types that this prefab requires to the provided set. This override calls the base implementation and then ensures ComponentType.ReadWrite() is included so entities created from this prefab have the InfoviewObjectStatusData component. -
public override void Initialize(EntityManager entityManager, Entity entity)
Copies the prefab configuration into the entity's component data. Specifically, this sets an InfoviewObjectStatusData component on the entity with m_Type and m_Range populated from the prefab's m_Type and m_Range fields.
Notes: - The prefab relies on the InfoviewObjectStatusData component type to exist; that component must have at least m_Type and m_Range fields compatible with the values assigned here. - The [ComponentMenu("Tools/Infomode/")] attribute places the prefab under the editor menu for easy authoring.
Usage Example
// Example: create an entity and apply this prefab's data to it
public void CreateObjectStatusInfomode(EntityManager entityManager)
{
// Create prefab instance (in editor/scriptable workflow this would typically be created/serialized)
var prefab = new ObjectStatusInfomodePrefab();
prefab.m_Type = ObjectStatusType.Damaged; // example enum value
prefab.m_Range = new Bounds1(0f, 100f); // example initialization (constructor depends on Bounds1 API)
// Create an entity (archetype must include InfoviewObjectStatusData if required by other systems)
var entity = entityManager.CreateEntity();
// Ensure the entity has the required component before Initialize is called, or let the prefab's GetPrefabComponents
// be used by the prefab system to create the correct archetype. For a manual approach, add the component first:
entityManager.AddComponentData(entity, new InfoviewObjectStatusData());
// Initialize the entity from the prefab (writes m_Type and m_Range into the component)
prefab.Initialize(entityManager, entity);
}
Additional tips: - When authoring prefabs via the game's prefab system, the prefab framework will call GetPrefabComponents to build the entity archetype automatically. Manual entity creation should make sure the archetype includes InfoviewObjectStatusData before calling Initialize. - Inspect or search for the InfoviewObjectStatusData definition to see all fields and how they are consumed by rendering/infoview systems.