Corgi Engine
v8.8
|
Add this component to an object and it will show a healthbar above it You can either use a prefab for it, or have the component draw one at the start More...
Public Types | |
enum | HealthBarTypes { HealthBarTypes.Prefab, HealthBarTypes.Drawn, HealthBarTypes.Existing } |
the possible health bar types More... | |
enum | TimeScales { TimeScales.UnscaledTime, TimeScales.Time } |
the possible timescales the bar can work on More... | |
Public Member Functions | |
virtual void | SetInitialActiveState () |
Forces the bar into its initial active state (hiding it if AlwaysVisible is false) More... | |
virtual void | ShowBar (bool state) |
Shows or hides the bar by changing its object's active state More... | |
virtual bool | BarIsShown () |
Whether or not the bar is currently active More... | |
virtual void | Initialization () |
Initializes the bar (handles visibility, parenting, initial value More... | |
virtual void | UpdateBar (float currentHealth, float minHealth, float maxHealth, bool show) |
Updates the bar More... | |
Public Attributes | |
HealthBarTypes | HealthBarType = HealthBarTypes.Drawn |
whether the healthbar uses a prefab or is drawn automatically More... | |
TimeScales | TimeScale = TimeScales.UnscaledTime |
defines whether the bar will work on scaled or unscaled time (whether or not it'll keep moving if time is slowed down for example) More... | |
MMProgressBar | HealthBarPrefab |
the prefab to use as the health bar More... | |
MMProgressBar | TargetProgressBar |
the MMProgressBar this health bar should update More... | |
Vector2 | Size = new Vector2(1f,0.2f) |
if the healthbar is drawn, its size in world units More... | |
Vector2 | BackgroundPadding = new Vector2(0.01f,0.01f) |
if the healthbar is drawn, the padding to apply to the foreground, in world units More... | |
Vector3 | InitialRotationAngles |
the rotation to apply to the MMHealthBarContainer when drawing it More... | |
Gradient | ForegroundColor |
if the healthbar is drawn, the color of its foreground More... | |
Gradient | DelayedColor |
if the healthbar is drawn, the color of its delayed bar More... | |
Gradient | BorderColor |
if the healthbar is drawn, the color of its border More... | |
Gradient | BackgroundColor |
if the healthbar is drawn, the color of its background More... | |
string | SortingLayerName = "UI" |
the name of the sorting layer to put this health bar on More... | |
float | Delay = 0.5f |
the delay to apply to the delayed bar if drawn More... | |
bool | LerpFrontBar = true |
whether or not the front bar should lerp More... | |
float | LerpFrontBarSpeed = 15f |
the speed at which the front bar lerps More... | |
bool | LerpDelayedBar = true |
whether or not the delayed bar should lerp More... | |
float | LerpDelayedBarSpeed = 15f |
the speed at which the delayed bar lerps More... | |
bool | BumpScaleOnChange = true |
if this is true, bumps the scale of the healthbar when its value changes More... | |
float | BumpDuration = 0.2f |
the duration of the bump animation More... | |
AnimationCurve | BumpAnimationCurve = AnimationCurve.Constant(0,1,1) |
the animation curve to map the bump animation on More... | |
MMFollowTarget.UpdateModes | FollowTargetMode = MMFollowTarget.UpdateModes.LateUpdate |
the mode the bar should follow the target in More... | |
bool | NestDrawnHealthBar = false |
if this is true, the drawn health bar will be nested below the MMHealthBar More... | |
bool | Billboard = false |
if this is true, a MMBillboard component will be added to the progress bar to make sure it always looks towards the camera More... | |
GameObject | InstantiatedOnDeath |
a gameobject (usually a particle system) to instantiate when the healthbar reaches zero More... | |
Vector3 | HealthBarOffset = new Vector3(0f,1f,0f) |
the offset to apply to the healthbar compared to the object's center More... | |
bool | AlwaysVisible = true |
whether or not the bar should be permanently displayed More... | |
float | DisplayDurationOnHit = 1f |
the duration (in seconds) during which to display the bar More... | |
bool | HideBarAtZero = true |
if this is set to true the bar will hide itself when it reaches zero More... | |
float | HideBarAtZeroDelay = 1f |
the delay (in seconds) after which to hide the bar More... | |
float | TestMinHealth = 0f |
a test value to use when pressing the TestUpdateHealth button More... | |
float | TestMaxHealth = 100f |
a test value to use when pressing the TestUpdateHealth button More... | |
float | TestCurrentHealth = 25f |
a test value to use when pressing the TestUpdateHealth button More... | |
bool | TestUpdateHealthButton |
Protected Member Functions | |
virtual void | Awake () |
On Start, creates or sets the health bar up More... | |
void | OnEnable () |
On enable, initializes the bar again More... | |
virtual void | DrawHealthBar () |
Draws the health bar. More... | |
virtual void | Update () |
On Update, we hide or show our healthbar based on our current status More... | |
virtual IEnumerator | FinalHideBar () |
Hides the bar when it reaches zero More... | |
virtual void | UpdateDrawnColors () |
Updates the colors of the different bars More... | |
virtual void | TestUpdateHealth () |
A test method used to update the bar when pressing the TestUpdateHealth button in the inspector More... | |
Protected Attributes | |
MMProgressBar | _progressBar |
MMFollowTarget | _followTransform |
float | _lastShowTimestamp = 0f |
bool | _showBar = false |
Image | _backgroundImage = null |
Image | _borderImage = null |
Image | _foregroundImage = null |
Image | _delayedImage = null |
bool | _finalHideStarted = false |
Add this component to an object and it will show a healthbar above it You can either use a prefab for it, or have the component draw one at the start
|
strong |
|
strong |
|
protectedvirtual |
On Start, creates or sets the health bar up
|
virtual |
Whether or not the bar is currently active
|
protectedvirtual |
Draws the health bar.
|
protectedvirtual |
Hides the bar when it reaches zero
|
virtual |
Initializes the bar (handles visibility, parenting, initial value
|
protected |
On enable, initializes the bar again
|
virtual |
Forces the bar into its initial active state (hiding it if AlwaysVisible is false)
|
virtual |
Shows or hides the bar by changing its object's active state
state |
|
protectedvirtual |
A test method used to update the bar when pressing the TestUpdateHealth button in the inspector
|
protectedvirtual |
On Update, we hide or show our healthbar based on our current status
|
virtual |
Updates the bar
currentHealth | Current health. |
minHealth | Minimum health. |
maxHealth | Max health. |
show | Whether or not we should show the bar. |
|
protectedvirtual |
Updates the colors of the different bars
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
bool MoreMountains.Tools.MMHealthBar.AlwaysVisible = true |
whether or not the bar should be permanently displayed
Gradient MoreMountains.Tools.MMHealthBar.BackgroundColor |
if the healthbar is drawn, the color of its background
Vector2 MoreMountains.Tools.MMHealthBar.BackgroundPadding = new Vector2(0.01f,0.01f) |
if the healthbar is drawn, the padding to apply to the foreground, in world units
bool MoreMountains.Tools.MMHealthBar.Billboard = false |
if this is true, a MMBillboard component will be added to the progress bar to make sure it always looks towards the camera
Gradient MoreMountains.Tools.MMHealthBar.BorderColor |
if the healthbar is drawn, the color of its border
AnimationCurve MoreMountains.Tools.MMHealthBar.BumpAnimationCurve = AnimationCurve.Constant(0,1,1) |
the animation curve to map the bump animation on
float MoreMountains.Tools.MMHealthBar.BumpDuration = 0.2f |
the duration of the bump animation
bool MoreMountains.Tools.MMHealthBar.BumpScaleOnChange = true |
if this is true, bumps the scale of the healthbar when its value changes
float MoreMountains.Tools.MMHealthBar.Delay = 0.5f |
the delay to apply to the delayed bar if drawn
Gradient MoreMountains.Tools.MMHealthBar.DelayedColor |
if the healthbar is drawn, the color of its delayed bar
float MoreMountains.Tools.MMHealthBar.DisplayDurationOnHit = 1f |
the duration (in seconds) during which to display the bar
MMFollowTarget.UpdateModes MoreMountains.Tools.MMHealthBar.FollowTargetMode = MMFollowTarget.UpdateModes.LateUpdate |
the mode the bar should follow the target in
Gradient MoreMountains.Tools.MMHealthBar.ForegroundColor |
if the healthbar is drawn, the color of its foreground
Vector3 MoreMountains.Tools.MMHealthBar.HealthBarOffset = new Vector3(0f,1f,0f) |
the offset to apply to the healthbar compared to the object's center
MMProgressBar MoreMountains.Tools.MMHealthBar.HealthBarPrefab |
the prefab to use as the health bar
HealthBarTypes MoreMountains.Tools.MMHealthBar.HealthBarType = HealthBarTypes.Drawn |
whether the healthbar uses a prefab or is drawn automatically
bool MoreMountains.Tools.MMHealthBar.HideBarAtZero = true |
if this is set to true the bar will hide itself when it reaches zero
float MoreMountains.Tools.MMHealthBar.HideBarAtZeroDelay = 1f |
the delay (in seconds) after which to hide the bar
Vector3 MoreMountains.Tools.MMHealthBar.InitialRotationAngles |
the rotation to apply to the MMHealthBarContainer when drawing it
GameObject MoreMountains.Tools.MMHealthBar.InstantiatedOnDeath |
a gameobject (usually a particle system) to instantiate when the healthbar reaches zero
bool MoreMountains.Tools.MMHealthBar.LerpDelayedBar = true |
whether or not the delayed bar should lerp
float MoreMountains.Tools.MMHealthBar.LerpDelayedBarSpeed = 15f |
the speed at which the delayed bar lerps
bool MoreMountains.Tools.MMHealthBar.LerpFrontBar = true |
whether or not the front bar should lerp
float MoreMountains.Tools.MMHealthBar.LerpFrontBarSpeed = 15f |
the speed at which the front bar lerps
bool MoreMountains.Tools.MMHealthBar.NestDrawnHealthBar = false |
if this is true, the drawn health bar will be nested below the MMHealthBar
Vector2 MoreMountains.Tools.MMHealthBar.Size = new Vector2(1f,0.2f) |
if the healthbar is drawn, its size in world units
string MoreMountains.Tools.MMHealthBar.SortingLayerName = "UI" |
the name of the sorting layer to put this health bar on
MMProgressBar MoreMountains.Tools.MMHealthBar.TargetProgressBar |
the MMProgressBar this health bar should update
float MoreMountains.Tools.MMHealthBar.TestCurrentHealth = 25f |
a test value to use when pressing the TestUpdateHealth button
float MoreMountains.Tools.MMHealthBar.TestMaxHealth = 100f |
a test value to use when pressing the TestUpdateHealth button
float MoreMountains.Tools.MMHealthBar.TestMinHealth = 0f |
a test value to use when pressing the TestUpdateHealth button
bool MoreMountains.Tools.MMHealthBar.TestUpdateHealthButton |
TimeScales MoreMountains.Tools.MMHealthBar.TimeScale = TimeScales.UnscaledTime |
defines whether the bar will work on scaled or unscaled time (whether or not it'll keep moving if time is slowed down for example)