StatBarBase
A class in Root.Township, Alta.StatSystem.
Base for a bar that shows one stat (such as on the player's wrist). Hides itself while the hand camera takes a photo. Client side.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
MonoBehaviour - Derived types
DiscreteStatBar,StatBarSimple
Constructors
| Member | What it is |
|---|---|
StatBarBase() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected bool isTakingPhoto | True while the hand camera is rendering a photo. |
protected Stat trackedStat | The stat instance being shown. |
protected StatDefinition trackedStatDefinition | The stat to look up and show. |
protected StatBarVisibilityGroup visibilityGroup | The group that holds the stat manager and controls visibility. |
Properties
| Member | What it is |
|---|---|
Stat Stat { get; } | The stat being shown. |
Events
| Member | What it is |
|---|---|
event Action<bool> UpdatedVisibility | Raised when the bar becomes visible or hidden. |
Methods
| Member | What it is |
|---|---|
void Disable() | Stops listening to the stat and the camera. |
virtual void Initialize() | Finds the tracked stat in the visibility group's stat manager and listens for changes. Hides the bar if the stat is missing. |
virtual void Ping(float duration) | Asks the bar to draw attention for a duration. Empty in the base class. |
virtual void SetAlpha(float alphaMultiplier) | Fades the bar. Empty in the base class. |
protected void OnBecameVisibleChanged(bool isVisible) | Raises UpdatedVisibility for subclasses. |
protected virtual void OnDestroy() | Stops listening to the hand camera. |
protected virtual void OnStatChanged(Stat stat) | Called when the stat changes, and once after initialising. Empty in the base class. |
protected virtual void SetRenderersEnabled(bool isEnabled) | Shows or hides the bar's renderers. Empty in the base class. |
3 private and internal methods
| Member | What it is |
|---|---|
private void DelayInitialize() | Runs one frame later to show the tracked stat's starting value. |
private void OnTakingPhoto(HandCamera handCamera, HandCameraEvent cameraEvent) | Hides the bar while a hand camera photo is rendered. |
private void OnTookPhoto(HandCamera handCamera, HandCameraEvent cameraEvent) | Shows the bar again after the photo, if its visibility group is on. |
Used in
Members of other types that take, return or hold a StatBarBase: