StatBar
A class in Root.Township, Alta.StatSystem.
A curved stat bar that adds notch marks for the stat's maximum and an icon to StatBarSimple. Display only.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
StatBarSimple - Attributes
RequireComponent - Documented in Stats
Constructors
| Member | What it is |
|---|---|
StatBar() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private float angleWidth | Angle the bar covers, used to place notches (default 90). |
private Material iconMaterial | Source material for the stat icon. |
private bool isUsingNotches | Whether the bar shows notches. |
private bool isUsingOverrideMaterial | True after ForceNotchMaterial. |
private List<StatBarNotch> notches | The spawned notches. |
private Transform notchParentTransform | Parent for spawned notches; the bar itself if empty. |
private StatBarNotch notchPrefab | Prefab spawned for each notch. |
private Material overrideNotchMaterial | Material set by ForceNotchMaterial. |
private Material reachedNotchMaterial | Source material for reached notches. |
private MeshRenderer statIconRenderer | Renderer for the stat icon. |
private Material unreachedNotchMaterial | Source material for unreached notches. |
Properties
Methods
| Member | What it is |
|---|---|
override void ForceNotchMaterial(Material notchesMaterial) | Uses one material for every notch from now on, instead of reached and unreached materials. |
override void Initialize() | Makes copies of the icon and notch materials so this bar can fade them alone. |
override void SetAlpha(float alphaMultiplier) | Fades the bar, icon and notch materials. |
protected override void OnStatChanged(Stat stat) | Updates the bar and then its notches. |
protected override void SetRenderersEnabled(bool isEnabled) | Shows or hides the bar and all notches. |
5 private and internal methods
| Member | What it is |
|---|---|
private void DebugNotchVisibility(StatDefinition definition, out float statMaximum) | Sets the editor preview maximum to 0. Leftover debug hook. |
private void DelayDestroy() | Destroys all notch objects. |
private void DelaySetup() | Calls SetupNotches with no stat. Leftover editor helper. |
private void OnValidate() | Does nothing. |
private void SetupNotches(Stat stat) | Colours notches by whether the stat reaches them (not on Android), and rebuilds and places them when the maximum changes. |
Used in
Members of other types that take, return or hold a StatBar: