Class SegmentController
Synchronizes the progression of three different segments by changing the fill amount of their corresponding Image.
Also manages the coroutines of the sub-segment shrink animation.
Inheritance
object
SegmentController
Assembly: cs.temp.dll.dll
Syntax
public class SegmentController : MonoBehaviour
Properties
DecreaseFillAmount
Declaration
public float DecreaseFillAmount { get; protected set; }
Property Value
DecreaseSegment
Declaration
public BarSegment DecreaseSegment { get; protected set; }
Property Value
FillSegment
Declaration
public FillSegment FillSegment { get; protected set; }
Property Value
IncreaseFillAmount
Declaration
public float IncreaseFillAmount { get; protected set; }
Property Value
IncreaseSegment
Declaration
public BarSegment IncreaseSegment { get; protected set; }
Property Value
LastIncreaseFillAmount
Declaration
public float LastIncreaseFillAmount { get; }
Property Value
MainFillAmount
Declaration
public float MainFillAmount { get; protected set; }
Property Value
ShrinkDelay
Declaration
public float ShrinkDelay { get; set; }
Property Value
ShrinkSpeed
Declaration
public float ShrinkSpeed { get; set; }
Property Value
UseAnimationWhenLimitAreChanged
Declaration
public bool UseAnimationWhenLimitAreChanged { get; set; }
Property Value
UseLerpToSmooth
Declaration
public bool UseLerpToSmooth { get; set; }
Property Value
Methods
GetActiveSegment()
Returns the active segment, the one that is currently visible above the fill segment.
Declaration
public BarSegment GetActiveSegment()
Returns
GetSegmentFillAmount(SegmentType)
Returns the FillAmount of a Segement's image
Declaration
public float GetSegmentFillAmount(SegmentType segmentType)
Parameters
Returns
IncrementFillSegmentAmount()
Increments the current image fill amount until it reachs the same amount of the increasing fill amount after a delay
Declaration
protected virtual IEnumerator IncrementFillSegmentAmount()
Returns
| Type |
Description |
| IEnumerator |
|
Initialize(float)
Declaration
public virtual void Initialize(float fillAmount)
Parameters
| Type |
Name |
Description |
| float |
fillAmount |
|
InstantlyUpdateDecreasingFilledAmount(float)
Declaration
public virtual void InstantlyUpdateDecreasingFilledAmount(float percentage)
Parameters
| Type |
Name |
Description |
| float |
percentage |
|
InstantlyUpdateFillAmount(float)
Declaration
public virtual void InstantlyUpdateFillAmount(float percentage)
Parameters
| Type |
Name |
Description |
| float |
percentage |
|
InstantlyUpdateIncreasingFilledAmount(float)
Declaration
public virtual void InstantlyUpdateIncreasingFilledAmount(float percentage)
Parameters
| Type |
Name |
Description |
| float |
percentage |
|
IsValid()
Returns false if at least one Segement is not valid.
Declaration
public virtual bool IsValid()
Returns
OnActiveSegmentChanged()
Raise the ActiveSegmentChangedEvent, we pass the new active segment in SegmentEventArgs.
Declaration
protected virtual void OnActiveSegmentChanged()
SetBackground(Sprite)
Set the background for all segements
Declaration
public void SetBackground(Sprite sprite)
Parameters
| Type |
Name |
Description |
| Sprite |
sprite |
|
SetSegmentFillAmount(float, SegmentType)
Sets the FillAmount of the a Segment's image
Declaration
public void SetSegmentFillAmount(float amount, SegmentType segmentType)
Parameters
| Type |
Name |
Description |
| float |
amount |
|
| SegmentType |
segmentType |
|
ShrinkDecreasingSegment()
Shrinks the Decreasing image fill amount until it reachs the same amount of the current image fill amount after a delay
Declaration
protected virtual IEnumerator ShrinkDecreasingSegment()
Returns
| Type |
Description |
| IEnumerator |
|
UpdateDecreasingFilledAmount(float)
If the decrease segment is enable we interupt the increase amount coroutine,
to start the decrease amount coroutine to show how much the Progress Bar lost.
Declaration
public virtual void UpdateDecreasingFilledAmount(float percentage)
Parameters
| Type |
Name |
Description |
| float |
percentage |
|
UpdateFilledAmount(object, ValueChangedEventArgs)
Every time the ProgressBar percentage changes we update the increasing or decreasing segment with the animation.
Unless the progress bar changed because
Declaration
public virtual void UpdateFilledAmount(object sender, ValueChangedEventArgs eventArgs)
Parameters
UpdateIncreasingFilledAmount(float)
If the increase segment is enable we interupt the decrease amount coroutine,
to start the increase amount coroutine to show how much the Progress Bar gained.
Declaration
public virtual void UpdateIncreasingFilledAmount(float percentage)
Parameters
| Type |
Name |
Description |
| float |
percentage |
|
Events
ActiveSegmentChangedEvent
Declaration
public event EventHandler<SegmentEventArgs> ActiveSegmentChangedEvent
Event Type