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
Inheritance
object
Counter

Constructors

Counter(int)

Creates a counter with a count-towards target.

public Counter(int target)

Parameters

target int

Properties

AutoRepeat

public bool AutoRepeat { get; set; }

Property Value

bool

Current

public int Current { get; }

Property Value

int

IsRunning

public bool IsRunning { get; set; }

Property Value

bool

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 int Remaining { get; }

Property Value

int

Target

public int Target { get; set; }

Property Value

int

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