Resources System - a system with which you can perform any operation with unlimited resources. Add, take, pay for purchases and upgrades.
Resources - list of all game resources.
Type - resource type.
Counter - resource counter link.
Test Mode - enables a test mode where you set a certain number of resources at startup.
Test Resources Counts - test resources values.
QUESTIONS:
How to get resource count? - Use GetResourceCount(ResourceType type);
private void Start()
{
var resourceCount = ResourcesSystem.Instance.GetResourceCount(ResourcesSystem.ResourceType.Banknotes);
Debug.Log($"Resource count: {resourceCount}");
}
2. How to change resource count? - Use AddResourceCount(ResourceType type, int value);
private void Start()
{
private void Start()
{
ResourcesSystem.Instance.AddResourceCount(ResourcesSystem.ResourceType.Banknotes, 100); //increase value
ResourcesSystem.Instance.AddResourceCount(ResourcesSystem.ResourceType.Banknotes, -80); //decrease value
}
}
3. How to use TryToBuy(ResourceType type, int price, Action onComplete)?
private void Start()
{
ResourcesSystem.Instance.TryToBuy(ResourcesSystem.ResourceType.Banknotes,100, OnComplete);
}
private void OnComplete()
{
Debug.Log("Bought!");
}