Skip to content

API reference

Class AchievementsModule

Namespace: MicroEngine.Achievements
Assembly: MicroEngine.Achievements.dll
Guide: Achievements

Achievements as an engine module: registers Tracker as the engine’s AchievementTracker service and schedules SystemName in PostFixed, which writes pending progress about once a second of simulated time (FlushInterval; unlocks are written at once by the tracker) and raises Stepped every step; progress is written too when the platform suspends the game. A composition that never adds the module has no tracker, no system and no achievement file. The Game façade adds it when the game declares achievements (TrackAchievements before the engine is composed).

C#
public sealed class AchievementsModule : IEngineModule

Inheritance

object ← AchievementsModule

Implements

IEngineModule

Examples

C#
var tracker = new AchievementTracker(catalog, new SaveStore("com.example.mygame"));
builder.Add(new AchievementsModule(tracker));

Constructors

AchievementsModule(AchievementTracker)

Creates the module over tracker.

C#
public AchievementsModule(AchievementTracker tracker)

Parameters

tracker AchievementTracker

Exceptions

ArgumentNullException

tracker is null.

Fields

FlushInterval

Seconds of simulated time between writes of plain progress: 1.

C#
public const float FlushInterval = 1

Field Value

float

SystemName

The name of the module’s frame system: “engine.achievements”.

C#
public const string SystemName = "engine.achievements"

Field Value

string

Properties

Tracker

The tracker the module registers and flushes.

C#
public AchievementTracker Tracker { get; }

Property Value

AchievementTracker

Methods

Configure(EngineBuilder)

Registers the tracker, schedules SystemName (before engine.input.end when the composition has it, the place it always had in a game’s step) and writes progress when the game is suspended.

C#
public void Configure(EngineBuilder builder)

Parameters

builder EngineBuilder

Step(float)

Advances the module by one step of dt seconds: raises Stepped, then writes progress when FlushInterval has passed.

C#
public void Step(float dt)

Parameters

dt float

Stepped

Raised every fixed step with the step’s length in seconds, before progress is written when due (the game’s unlock banners advance on it).

C#
public event Action<float>? Stepped

Event Type

Action<float>?