<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />
Navigation
</aside>
<aside> 💡 The game has two currencies. Coins are earned for the run distance and spent on upgrades. Gems are found in the world and are used for an instant purchase and for pre-run modifiers.
</aside>
Assets/Project Files/Data/Currency Database.asset holds the list of currencies with the icon and the default amount (0 for both).
To add a currency, add a value to CurrencyType in MD_CurrencyType.cs and add the currency to the database.
| Method | Description |
|---|---|
Get(type) |
Current amount. |
HasAmount(type, amount) |
Checks that the balance is enough. |
Add(type, amount) |
Adds currency. |
Substract(type, amount) |
Spends currency. |
Set(type, amount) |
Sets the balance. |
GetCurrency(type) |
The Currency object with the icon. |
SubscribeGlobalCallback(callback), UnsubscribeGlobalCallback(callback) |
Callback for every balance change. |
// Spend 50 coins when the player has enough
if (CurrencyController.HasAmount(CurrencyType.Coins, 50))
CurrencyController.Substract(CurrencyType.Coins, 50);
The CurrencyUIPanelSimple component shows a balance on a page. See the Currency module doc for the full API.
| Source | Credit |
|---|---|
| Distance of a run | After the run, through the result page and the coin cloud. |
| Run coins | Held in RunCoinsController, paid with the run reward. |
| One-time coins | Paid at the pickup. |
| Coins Fever booster | Added to the run coins. |
See Run Result & Level Complete for the formula.
Gems come from GemPickup. They are credited at once and each gem is collected once. See Pickups.
The upgrade slot normally shows the coin price of the next stage. When the player does not have enough coins and has already bought something on the current start screen, the slot offers the same stage for gems.
| Rule | Description |
|---|---|
| Price | 1 gem for the first gem purchase, 2 for the second, 3 for the third and so on. |
| Shared counter | All upgrade slots share one counter. The upgrade level and the game level do not change the price. |
| Reset | ResetUpgradeGemOffers() of the start screen resets the counter and the offers on every new run. |
| Fresh start screen | After a run, the slots show the coin price even when it is short, because the coin cloud credits the coins with a delay. |
UpgradeGemPriceController:
| Member | Description |
|---|---|
CurrentCost |
The gem price of the next gem purchase. |
TryPurchase() |
Spends the gems and increases the counter. |
ResetPurchases() |
Resets the counter. |
A modifier costs Gems Cost gems or a rewarded video. See Pre-Run Modifiers.
| Task | Where |
|---|---|
| Coins per meter | Game Data → Money Per Distance |
| Price of a stage | The stage of the upgrade asset |
| Bonus of a stage | The stage of the upgrade asset |
| Value of a coin | Amount of the coin prefab |
| Gem price of a modifier | Gems Cost of the modifier asset |
The Reward module is used for the No Ads reward. Assets/Project Files/Data/Rewards/Reward No Ads.asset removes the forced ads. UIStartScreen listens to AdsManager.ForcedAdDisabled to refresh the button. See Publishing.