Skip to main content

HealthBar

A class in Root.Township, Alta.QuickAccessActions.

Client debug health bar: a quad above a creature that shows its health stat. Made by ToggleEnemyHealthBars.

Constructors​

MemberWhat it is
HealthBar(Transform enemy, Stat healthStat, Shader shader, Vector3 barScale, float verticalOffset, int _Progress)Creates a HealthBar from enemy, healthStat, shader, barScale, verticalOffset and _Progress.

Fields​

MemberWhat it is
Transform transformThe bar quad's transform, parented to the creature.
3 private and internal fields
MemberWhat it is
private readonly int _ProgressShader property id for the bar's fill.
private Stat healthStatThe health stat shown.
private Material materialThe bar's own material instance.

Methods​

MemberWhat it is
void Dispose()Unhooks from the stat and destroys the material and quad.
void UpdateHealthBar(Stat s)Sets the shader progress to health between its default minimum and maximum. Runs when the stat changes.
void UpdateRotation(Vector3 headPosition)Turns the bar to face the given head position, flat on the Y axis.
2 private and internal methods
MemberWhat it is
private Transform GetHealthBar(Vector3 barScale)Creates the quad, scales it, removes its collider and gives it the bar material.
private float GetHighestPointOnCreature(Transform creature)Height of the creature's highest collider above its position.

Used in​

Members of other types that take, return or hold a HealthBar: