ToggleEnemyHealthBars
A class in Root.Township, Alta.QuickAccessActions.
Debug quick access action that shows health bars over every AI agent in the scene. Client only.
- Listed in Players and characters
- Inherits or implements
QuickAccessMenuAction - Attributes
CreateAssetMenu
Constructors
| Member | What it is |
|---|---|
ToggleEnemyHealthBars() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private readonly int _Progress | Shader property ID for the bar fill. |
private Vector3 barScale | Size of each bar. |
private Dictionary<NetworkEntity, HealthBar> healthBarMapping | Bar for each agent entity. |
private Shader healthShader | Shader used for the bars. |
private AltaCoroutine rotationUpdater | The running rotation coroutine, null when off. |
private StatDefinition statDefinition | Stat shown by the bar (health). |
private float verticalOffset | Height of the bar above the agent. |
Properties
| Member | What it is |
|---|---|
override bool IsActive { get; } | True while the bars are shown. |
override bool IsValid { get; } | Always true. |
Methods
| Member | What it is |
|---|---|
override void Run(Controller controller) | Turns bars on for all agents found at that moment, or removes them all. Agents spawned later get none. |
3 private and internal methods
| Member | What it is |
|---|---|
private bool CheckEnemyNeedsHealthBar(StatManager enemy, out Stat stat) | True if the stat manager's object has an AI Agent and the health stat; logs an error if the stat is missing. |
private void ManagerDispose(NetworkEntity entity, bool isUnload) | Removes an agent's bar when its entity is destroyed. |
private IEnumerator UpdateRotations() (iterator) | Coroutine on the local player that turns every bar to face the head each frame. |