Skip to main content

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.

Constructors​

MemberWhat it is
ToggleEnemyHealthBars()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

7 private and internal fields
MemberWhat it is
private readonly int _ProgressShader property ID for the bar fill.
private Vector3 barScaleSize of each bar.
private Dictionary<NetworkEntity, HealthBar> healthBarMappingBar for each agent entity.
private Shader healthShaderShader used for the bars.
private AltaCoroutine rotationUpdaterThe running rotation coroutine, null when off.
private StatDefinition statDefinitionStat shown by the bar (health).
private float verticalOffsetHeight of the bar above the agent.

Properties​

MemberWhat it is
override bool IsActive { get; }True while the bars are shown.
override bool IsValid { get; }Always true.

Methods​

MemberWhat 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
MemberWhat 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.