using System.Collections; using System.Collections.Generic; using UnityEngine; public class CoinControler : MonoBehaviour { public AdventureCoinsManager adventureCoinsManager; void Start() { if (adventureCoinsManager == null) { adventureCoinsManager = FindObjectOfType(); } } void Update() { if (Input.GetKeyDown(KeyCode.G)) { adventureCoinsManager.AddAdventureGold(10); } if (Input.GetKeyDown(KeyCode.S)) { adventureCoinsManager.AddAdventureSilver(10); } if (Input.GetKeyDown(KeyCode.H)) { if (adventureCoinsManager.SpendAdventureGold(5)) { Debug.Log("Successfully spent 5 Adventure Gold."); } else { Debug.Log("Failed to spend 5 Adventure Gold."); } } if (Input.GetKeyDown(KeyCode.D)) { if (adventureCoinsManager.SpendAdventureSilver(5)) { Debug.Log("Successfully spent 5 Adventure Silver."); } else { Debug.Log("Failed to spend 5 Adventure Silver."); } } } }