CoinManager

Allows the player to collect Coins. Contains functions to Add and Remove Coins, as well as for checking if payments can be completed, etc...

circle-info

This can be found in GeneralManagers object within the Player

  • useCoins: Flag to indicate if the game uses coins

circle-exclamation

Functions & Accesors | CoinManager.cs

Instance ( CoinManager ) / Public Static Singleton

CoinManager Singleton

coins ( int) / Public Getter, Private Setter

Property to access the coin count (read-only from outside)

AddCoins ( int amount )

Add coins to the total count

  • amount: Amount of coins to add.

RemoveCoins ( int amount )

Remove coins from the total count

  • amount: Amount of coins to remove.

CheckIfEnoughCoins ( int amount ) | Returns a Boolean

Check if there are enough coins

  • amount: Amount to check. If this amount is bigger than the available coins, CheckIfEnoughCoins will return false.

CheckIfEnoughCoinsAndPurchase ( int amount ) | Returns a Boolean

Purchase action, checking and deducting coins if sufficient

  • amount: Amount to check. If this amount is bigger than the available coins, CheckIfEnoughCoins will return false. If the transaction is completed ( The player has more coins than the price ( amount ), this will return true.

ResetCoins ( )

Reset the coin count to zero

Last updated