Unlockables are a Hiro GDK meta system which allows the player to unlock rewards in the game. The rewards can be anything from a new character, a new weapon, or anything relevant for your game. Unlockables can be unlocked by the player by waiting for a period of time or by watching a rewarded video.
You can configure unlockables so that players only have a limited number of slots for active unlockables at any time, and also provide players the ability to purchase extra slots to store more unlockables, up to a maximum limit.
Customization parameters #
All unlockables and their configuration is done through a JSON definition.
The following JSON represents the customization parameters you can use to configure the default user experience for the Unlockables system.
Unlockable slots #
|The maximum number of slots a player can have active at any time.|
|The number of active slots, if any, each player starts with.|
|The total number of slots, active and inactive, a player can have.|
|The cost to purchase additional active slots.|
Each unlockable is keyed by id and may define the following properties:
|The name of this unlockable.|
|The category, if any, of this unlockable.|
|The description of this unlockable.|
|The cost to begin unlocking this unlockable.|
|The total time (in seconds) a player must wait before this item in unlocked.|
|The cost to advance the wait time by one unit of time, defined in |
|The amount of time to be advanced on |
|An object that defines what rewards the player should receive after unlocking this unlockable.|
|An array of collectables the player should receive as a reward.|
|A string hint for the client (e.g. addressable id).|
Initializing the unlockables system #
The unlockables system relies on the Nakama System which must be passed in as dependency via the constructor.
Subscribing to changes in the unlockables system #
You can listen for changes in the unlockables system so that you can respond appropriately, such as updating the UI, by implementing the appropriate interface.
Refreshing the unlockables system #
To ensure the unlockables system has the latest information from Nakama you can refresh it.
Listing available unlockables #
You can list available unlockables.
Claiming an unlockable reward #
You can claim an unlockable reward.
Purchasing a slot #
You can purchase an additional unlockable slot.
Purchasing an unlock #
You can purchase an unlock of a slot.
Begin unlocking a slot #
You can begin unlocking a slot.
Creating an unlockable #
You can create an unlockable.
Inspecting the overflow slot #
You can inspect the overflow slot.