Achievements

using Databrain.Stats;

public class StatsAchievement : DataObject {}

The achievements data type lets you easily create unlockable achievements. Simply define the max score an achievement must reach to get unlocked. Use the following API to add points and listen to an unlocked event:

  1. Create a new achievement data object.

  2. Assign the total score and create a new OnAchievementUnlocked event.

Stats add-on comes with a dedicated StatsEvents type which contains either the unlcoked achievement, a new value or a new progression.

  1. OPTIONAL: If you have installed the Logic add-on, you can also add a custom logic which gets called on achievement unlocked.

Optional, only if Logic add-on is installed

API

Add achievement points

AddPoints(int _points);

The points are automatically added to the runtime data object of the achievement data object.

OnAchievementUnlocked

Listen to the StatsEvents OnAchievementUnlocked

CurrentScore

Get the current score of the achievement

IsUnlocked

Get whether achievement is unlocked or not.

Last updated