Files
Shopkeeper/Assets/Scripts/Items/CustomerPayment.cs
Caleb Sandford deQuincey 47944971ca initial game submission
2025-06-10 22:13:25 +01:00

24 lines
496 B
C#

using UnityEngine;
public class CustomerPayment : MonoBehaviour
{
public float moneyAvailable = 10f;
public bool CanAfford(float price)
{
return moneyAvailable >= price;
}
public void Pay(float amount)
{
if (CanAfford(amount))
{
moneyAvailable -= amount;
Debug.Log($"💸 Customer pays £{amount}.");
}
else
{
Debug.Log("🚨 Not enough money! Customer walks away.");
}
}
}