Currencies Manager
Presented by ICurrenciesManager interface, this system operates with in-game currencies. You can add or withdraw them via this manager, as well as get information about specific currency.
To use this system, inject ICurrenciesManager interface into your class, as shown below:
Parameters in inspector
currencies – reference to serialized object which contains game currencies collection. By default, it refers to Assets/Scriptables/Economics/CurrenciesCollection.asset.
saveAfterEachChange – if true, currencies manager will automatically save currencies state after the each currencies amount change. Otherwise, you'll need to call SaveState method manually when you need.
Available methods
This method adds a certain amount of currency of currencyType to player's in-game account. If amount is negative, currency will be withdrawn instead.
Examples:
This method sets a certain amount of currency.
This method withdraws amount of currency of currencyType from player's in-game account. If player doesn't have enough amount of this currency, it will be set to 0.
Example:
This method returns current amount of currencyType currency on player's in-game account.
Example:
This method writes information about currencyType currency into currencyInfo structure. In case of success (if it finds information about such currency), this method returns true, otherwise it returns false.
Example:
This method saves currencies state.
Last updated