Class Money
Provides static access to financial operations, including methods for managing cash balance, creating online transactions, and calculating net worth.
public static class Money
- Inheritance
-
Money
- Inherited Members
Methods
AddNetworthCalculation(Action<object>)
Registers a callback to be invoked during net worth calculation.
public static void AddNetworthCalculation(Action<object> callback)
Parameters
callbackAction<object>The callback to be executed when net worth is calculated. It receives an object as its parameter.
ChangeCashBalance(float, bool, bool)
Adjusts the cash balance by the specified amount.
public static void ChangeCashBalance(float amount, bool visualizeChange = true, bool playCashSound = false)
Parameters
amountfloatThe amount to modify the cash balance by. Positive values increase the balance, and negative values decrease it.
visualizeChangeboolIndicates whether the cash change should be visualized on the HUD.
playCashSoundboolIndicates whether a sound effect should be played to signify the cash adjustment.
CreateCashInstance(float)
Creates a new cash instance with the specified balance.
public static CashInstance CreateCashInstance(float amount)
Parameters
amountfloatThe initial amount of cash to set in the instance.
Returns
- CashInstance
A newly created instance of cash with the specified balance.
CreateOnlineTransaction(string, float, float, string)
Creates an online transaction.
public static void CreateOnlineTransaction(string transactionName, float unitAmount, float quantity, string transactionNote)
Parameters
transactionNamestringThe name of the transaction.
unitAmountfloatThe monetary amount per unit involved in the transaction.
quantityfloatThe number of units in the transaction.
transactionNotestringAn optional note or description for the transaction.
GetCashBalance()
Retrieves the current cash balance.
public static float GetCashBalance()
Returns
- float
The current cash balance as a floating-point value.
GetNetWorth()
Retrieves the total net worth, including all cash and online balances combined.
public static float GetNetWorth()
Returns
- float
The total net worth as a floating-point value.
GetOnlineBalance()
Retrieves the current online balance.
public static float GetOnlineBalance()
Returns
- float
The current amount of online balance.
RemoveNetworthCalculation(Action<object>)
Removes a previously registered networth calculation callback.
public static void RemoveNetworthCalculation(Action<object> callback)
Parameters
Events
OnBalanceChanged
Event triggered whenever there is a change in the balance, including cash balance or online transactions.
public static event Action? OnBalanceChanged