Search Results for

    Show / Hide Table of Contents

    Class Indicator

    Uses an Image component with a Sprite and follows the current value of the progress bar.
    We can use a 2D mask to prevent the RectTransform, and therefore the image, from extending beyond the progress bar.
    We can also choose any color for the image, but I recommend setting UseSegmentColor to true and then modifying the ColorBrightnessMultiplier.
    This way, the image can be slightly brighter (positive multiplier) or darker (negative multiplier) than the colour of the currently active segment.

    Inheritance
    object
    Indicator
    Namespace: TetraCreations.ProgressBarSystem
    Assembly: cs.temp.dll.dll
    Syntax
    [Serializable]
    public class Indicator

    Fields

    ColorBrightnessMultiplier

    Declaration
    public float ColorBrightnessMultiplier
    Field Value
    Type Description
    float

    Enable

    Declaration
    public bool Enable
    Field Value
    Type Description
    bool

    OriginHorizontal

    Declaration
    public OriginHorizontal OriginHorizontal
    Field Value
    Type Description
    OriginHorizontal

    OriginVertical

    Declaration
    public OriginVertical OriginVertical
    Field Value
    Type Description
    OriginVertical

    Use2DMask

    Declaration
    public bool Use2DMask
    Field Value
    Type Description
    bool

    UseSegmentColor

    Declaration
    public bool UseSegmentColor
    Field Value
    Type Description
    bool

    Properties

    Color

    Get / Set the indicator color.

    Declaration
    public Color Color { get; set; }
    Property Value
    Type Description
    Color

    Initialized

    Determines if the indicator is ready to be used.

    Declaration
    public bool Initialized { get; protected set; }
    Property Value
    Type Description
    bool

    Size

    Get / Set the indicator rect transform size.

    Declaration
    public float Size { get; set; }
    Property Value
    Type Description
    float

    Methods

    Hide()

    Hide the indicator

    Declaration
    public void Hide()

    Initialize(ProgressBar)

    Initial setup, we get the rectTransform of the ProgressBar and the FillSegment to calculate the indicator position when the fill amount change.

    Declaration
    public void Initialize(ProgressBar progressBar)
    Parameters
    Type Name Description
    ProgressBar progressBar

    Initialize2DMask()

    Get the RectMask2D component and Enabled it.

    Declaration
    protected virtual void Initialize2DMask()

    OnActiveSegmentChanged(object, SegmentEventArgs)

    When the active segment change we may use it's color to change the indicator's color to a brighter or darker tone.

    Declaration
    protected virtual void OnActiveSegmentChanged(object sender, SegmentEventArgs e)
    Parameters
    Type Name Description
    object sender
    SegmentEventArgs e

    OnProgressBarValueChanged(object, ValueChangedEventArgs)

    Change the indicator position and visibility when progress bar values changed

    Declaration
    protected virtual void OnProgressBarValueChanged(object sender, ValueChangedEventArgs args)
    Parameters
    Type Name Description
    object sender
    ValueChangedEventArgs args

    SetFillMethodAndOrigin(ProgressBar)

    Set the fill method and origin of the indicator based on the ProgressBar values.

    Declaration
    protected virtual bool SetFillMethodAndOrigin(ProgressBar progressBar)
    Parameters
    Type Name Description
    ProgressBar progressBar
    Returns
    Type Description
    bool

    SetPosition(float)

    Move the indicator horizontally on the right end of the filled area segment

    Declaration
    protected virtual void SetPosition(float percentage)
    Parameters
    Type Name Description
    float percentage

    SetSegmentColor(Color)

    Set the indicator color to a brighter or darker using the segment color so we can see the indicator.

    Declaration
    protected virtual void SetSegmentColor(Color color)
    Parameters
    Type Name Description
    Color color

    Segment color

    SetSize()

    Set the size of the Indicator's RectTransform according to the chosen fill method.

    Declaration
    protected virtual void SetSize()

    Show()

    Show the indicator

    Declaration
    public void Show()

    ToggleIndicatorVisibility(float)

    Show the indicator if the progress bar amount is above 0.01f, otherwise hide it

    Declaration
    protected void ToggleIndicatorVisibility(float progressBarPercentage)
    Parameters
    Type Name Description
    float progressBarPercentage
    In This Article
    Back to top Tetra Creations documentation