Skip to content

UiShieldBar

The UiShieldBar class renders the zombie shield health bar on the HUD. It auto-hides when no shield is active and auto-shows when one is present.

UiShieldBar private

Extends UiComponent.

Properties

NameTypeDescription
uiUiCurrent Ui instance. Inherited from UiComponent.
componentElemHTMLElementThe root #hud-shield-bar DOM element. Inherited from UiComponent.
barElemHTMLElementThe .hud-shield-bar-inner element whose width represents shield health.
lastPlayerTickobjectCached previous tick values for zombieShieldHealth and zombieShieldMaxHealth.

Methods

constructor()

ts
function constructor(ui: Ui): void

Initializes the shield bar, queries the inner bar element, and registers a listener for playerTickUpdate.

onPlayerTickUpdate()

ts
function onPlayerTickUpdate(playerTick: { zombieShieldHealth: number, zombieShieldMaxHealth: number }): void

If zombieShieldMaxHealth is null or 0, hides the bar. Otherwise, updates the bar width percentage when values change and calls show().