Public classes

LowHealthController
LowHealthDirectAccess


Introduction page

LowHealthController
Derived from MonoBehaviour


Main class of Low Health effects.

Attach this script to the camera where you want low health effects to be displayed. Set desired values in Unity inspector window or by setting values toi fields of this class. Then use SetPlayerHealth() methods in this class to set the player's health runtime. Any wanted effects will take place smoothly and automatically.


Fields

public bool colorLossEnabledColor loss enabled or disabled.
public bool detailLossEnabledDetail loss enabled or disabled.
public bool doubleVisionEnabledDouble vision enabled or disabled.
public bool showInEditorSet effects visible in editor.
public bool stopEffectsWhenZeroHealthStop any moving effects when player health is 0.
public bool visionLossEnabledVision loss enabled or disabled.
public float colorLossStartsAtHealth level (from 0 to 1) where color loss effect starts.
public float colorLossTowardRedStartsAtHealth level (from 0 to 1) where screen starts to turn red instead of gray.
public float detailLossMaxEffectDetail loss effect maximum amount when player health is 0.
public float detailLossStartsAtHealth level (from 0 to 1) where detail loss effect starts.
public float doubleVisionMaxEffectDouble vision effect maximum amount when player health is 0.
public float doubleVisionStartsAtHealth level (from 0 to 1) where double vision effect starts.
public float doubleVisionWavingAdditional waving effect to make double vision less static.
public float simulateHealthSimulated player health in editor.
public float visionLossHeartBeatAdditional heartbeat effect.
public float visionLossMaxEffectVision loss effect maximum amount when player health is 0.
public float visionLossStartsAtHealth level (from 0 to 1) where vision loss effect starts.

Methods

public void ResetToDefaultValues ()Reset all fields in this class to their default values.
public void SetPlayerHealthInstantly (float playerHealth)Set player health instantly.
public void SetPlayerHealthSmoothly (float playerHealth, float seconds)Set player health smoothly.
public void UpdateShaderProperties ()Update shader properties.

Fields

public bool colorLossEnabled

Color loss enabled or disabled.


public bool detailLossEnabled

Detail loss enabled or disabled.


public bool doubleVisionEnabled

Double vision enabled or disabled.


public bool showInEditor

Set effects visible in editor. This value is used by Unity inspector and there's no need to access this value from code.


public bool stopEffectsWhenZeroHealth

Stop any moving effects when player health is 0.


public bool visionLossEnabled

Vision loss enabled or disabled.


public float colorLossStartsAt

Health level (from 0 to 1) where color loss effect starts.


public float colorLossTowardRedStartsAt

Health level (from 0 to 1) where screen starts to turn red instead of gray. 0 to disable effect. Setting this value equal or higher than 'colorLossStartsAt' makes color loss to turn red instead of gray from very beginning.


public float detailLossMaxEffect

Detail loss effect maximum amount when player health is 0.


public float detailLossStartsAt

Health level (from 0 to 1) where detail loss effect starts.


public float doubleVisionMaxEffect

Double vision effect maximum amount when player health is 0.


public float doubleVisionStartsAt

Health level (from 0 to 1) where double vision effect starts.


public float doubleVisionWaving

Additional waving effect to make double vision less static. 0 to disable effect, 1 for maximum effect.


public float simulateHealth

Simulated player health in editor. This value is used by Unity inspector and there's no need to access this value from code.


public float visionLossHeartBeat

Additional heartbeat effect. 0 to disable effect, 1 for maximum effect.


public float visionLossMaxEffect

Vision loss effect maximum amount when player health is 0.


public float visionLossStartsAt

Health level (from 0 to 1) where vision loss effect starts.


Methods

public void ResetToDefaultValues ()

Reset all fields in this class to their default values. Typically this is used only internally by Unity inspector.


public void SetPlayerHealthInstantly (float playerHealth)

Set player health instantly. Any effect that should be visible with this health, will take place immediately.

ParametersplayerHealthPlayer new health, value between 0.0 and 1.0. If value is less than 0 or more than 1, value is set to 0 or 1.


public void SetPlayerHealthSmoothly (float playerHealth, float seconds)

Set player health smoothly. All the effects will take place relatively slowly, giving nice transition between health states.

ParametersplayerHealthPlayer new health, value between 0.0 and 1.0. If value is less than 0 or more than 1, value is set to 0 or 1.
 secondsSeconds how long it takes before all the effects are fully visible.


public void UpdateShaderProperties ()

Update shader properties. This is typically called automatically by this script or Unity inspector whenever needed.