Progressor

class in Doozy.Engine.Progress / Inherits from: MonoBehaviour

Description

The Progressor animates a value between a minimum and a maximum interval. It also calculates the progress value (from 0 to 1) and the inverse progress (from 1 to 0).

This component is meant to help visualize a progression of an operation (e.g. a scene load progress).

It can be used to update visual elements of an energy bar, a health bar or any type of progress indicator.

It can be linked to anything that takes a value (from min to max) or a progress value (from 0 to 1 or from 0% to 100%).

Properties

  •  public float Progress – Returns the current progress value (float between 0 and 1)

  •  public float InverseProgress – Returns the inverse value of current Progress value (float between 1 and 0)

  •  public float Value – Returns the current Value (float between MinValue and MaxValue)

  •  public float MinValue – Returns the minimum value that the current Value can have

  •  public float MaxValue – Returns the maximum value that the current Value can have

  •  public bool WholeNumbers – Returns TRUE if the current Value will rounded to the nearest integer

Public Variables

  •  public bool DebugMode – Enables relevant debug messages to be printed to the console

  •  public List<ProgressTarget> ProgressTargets – Progress targets that will get updated every time the current Value or Progress value change

  •  public bool AnimateValue – If TRUE, when the current Value or Progress value get updated, the change will be animated

  •  public float AnimationDuration – Duration for the current Value to reach the target value when AnimateValue is enabled

  •  public Ease AnimationEase – The ease used by the value animator when AnimateValue is enabled

  •  public bool AnimationIgnoresUnityTimescale – Determines if the value animator should respect ~Unity~ Timescale, when AnimateValue is enabled

  •  public ResetValue OnEnableResetValue – Reset behavior for the current Value that happens OnEnable

  •  public ResetValue OnDisableResetValue – Reset behavior for the current Value that happens OnDisable

  •  public float CustomResetValue – Custom reset value for the current Value, used if ResetValue.ToCustomValue is set for either OnEnableResetValue or OnDisableResetValue

  •  public ProgressEvent OnValueChanged – Callback executed when the current Value has changed. Passes the current Value (float between MinValue and MaxValue)

  •  public ProgressEvent OnProgressChanged – Callback executed when the current Value has changed and the Progress has been updated. Passes the Progress value (float between 0 and 1)

  •  public ProgressEvent OnInverseProgressChanged – Callback executed when the current Value has changed and the Progress has been updated. Passes the InverseProgress value (float between 1 and 0). InverseProgress = 1 – Progress

Public Methods

  • public void OnValueUpdated() – Method called every time the current Value gets updated

  • public void UpdateProgressTargets() – Updates all the progress targets by calling the UpdateTarget method for each target

  • public void SetValue(float value) – Updates the current Value for this Progressor

  • public void SetValue(float value, bool instantUpdate) – Updates the current Value for this Progressor. Ignores the AnimateValue option if instantUpdate is passed as TRUE

  • public void SetProgress(float progressValue) – Updates the current Value for this Progressor by updating the Progress value (progressValue is clamped between 0 and 1). current Value = MinValue + progressValue * (MaxValue – MinValue)

  • public void SetProgress(float progressValue, bool instantUpdate) – Updates the current Value for this Progressor by updating the Progress value (progressValue is clamped between 0 and 1). Ignores the AnimateValue option if instantUpdate is passed as TRUE. current Value = MinValue + progressValue * (MaxValue – MinValue)

  • public float GetProgress(TargetProgress direction) – Depending on the direction, returns either the Progress or the InverseProgress value

  • public void UpdateProgress() – Invokes the OnProgressChanged and OnInverseProgressChanged events

  • public void SetMin(float value) – Updates the MinValue

  • public void SetMax(float value) – Updates the MaxValue

  • public void EnableWholeNumbers() – Forces the current Value only be allowed to be whole numbers

  • public void DisableWholeNumbers() – Allows the current Value to be any fractional number

  • public void ResetValueTo(ResetValue resetValue) – Resets the current Value to the set reset value instantly

  • public void ResetValueTo(ResetValue resetValue, bool instantUpdate) – Resets the current Value to the set reset value. The reset happens instantly if instantUpdate is passed as TRUE

  • public float ClampValueBetweenMinAndMax(float value, bool roundValue = false) – Returns the passed value clamped between MinValue and MaxValue

  • public Tween GetAnimationTween(float targetValue, float duration, Ease ease, bool ignoreTimescale) – Returns a new Tween that will be used to animate the current Value, if AnimateValue is enabled