Table of Contents

Class Counter

Namespace
Luny
/
Assembly
Luny.dll

A stateful manager for discrete integer counts (e.g., frames or heartbeats). Supports auto-repeat and progress tracking.

public sealed class Counter
Expand Details ...
Inheritance
Object
Counter

Constructors

Counter(Int32)

Creates a counter with a count-towards target.

public Counter(Int32 target)

Parameters

Type Name Description
Int32
target

Properties

AutoRepeat

public Boolean AutoRepeat { get; set; }

Property Value

Boolean

Current

public Int32 Current { get; }

Property Value

Int32

IsRunning

public Boolean IsRunning { get; set; }

Property Value

Boolean

Progress

Returns the progress as a normalized value (0.0 to 1.0).

public Double Progress { get; }

Property Value

Double

Remaining

Returns the remaining count.

public Int32 Remaining { get; }

Property Value

Int32

Target

public Int32 Target { get; set; }

Property Value

Int32

Methods

Increment()

Increments the counter by one, unless paused. Fires OnElapsed if target is reached.

public void Increment()

Pause()

Pauses the counter. Does not reset Current count.

public void Pause()

Resume()

Resumes the counter if paused. Does nothing if not paused.

public void Resume()

Start()

Starts or restarts the counter from zero. Unpauses Counter if paused.

public void Start()

Stop()

Stops the counter and resets Current count to zero.

public void Stop()

ToString()

public override String ToString()

Returns

String

Events

OnElapsed

public event Action OnElapsed

Event Type

Action