UnityBiz/Assets/scripts/AdventureCoinsManager.cs
adamwi1000 b854205dcb test
2024-08-02 06:41:41 +02:00

64 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AdventureCoinsManager : MonoBehaviour
{
public int AdventureGold { get; private set; }
public int AdventureSilver { get; private set; }
void Start()
{
AdventureGold = 0;
AdventureSilver = 0;
}
public void AddAdventureGold(int amount)
{
if (amount > 0)
{
AdventureGold += amount;
Debug.Log("Added " + amount + " Adventure Gold. Total: " + AdventureGold);
}
}
public void AddAdventureSilver(int amount)
{
if (amount > 0)
{
AdventureSilver += amount;
Debug.Log("Added " + amount + " Adventure Silver. Total: " + AdventureSilver);
}
}
public bool SpendAdventureGold(int amount)
{
if (amount > 0 && AdventureGold >= amount)
{
AdventureGold -= amount;
Debug.Log("Spent " + amount + " Adventure Gold. Remaining: " + AdventureGold);
return true;
}
Debug.Log("Not enough Adventure Gold to spend.");
return false;
}
public bool SpendAdventureSilver(int amount)
{
if (amount > 0 && AdventureSilver >= amount)
{
AdventureSilver -= amount;
Debug.Log("Spent " + amount + " Adventure Silver. Remaining: " + AdventureSilver);
return true;
}
Debug.Log("Not enough Adventure Silver to spend.");
return false;
}
}