public bool HasResource(Helpers.ResourceType resourceType, int amount) { if (resourceType == Helpers.ResourceType.NONE) { return(true); } if (PlayerProfileManager.Instance.GetResourceBalance(resourceType) >= amount) { return(true); } return(false); }
public bool SpendResource(Helpers.ResourceType resourceType, int amount) { if (HasResource(resourceType, amount)) { //NONE is effectively free. if (resourceType == Helpers.ResourceType.NONE) { return(true); } return(PlayerProfileManager.Instance.SpendResources(resourceType, amount)); } else { Debug.Log("Not enough " + resourceType.ToString() + " to complete purchase."); return(false); } }
public bool AddResource(Helpers.ResourceType resourceType, int amount) { if (resourceType == Helpers.ResourceType.NONE) { return(true); } if (amount < 0) { Debug.LogWarning("Attempted to add negative resource amount. This is not allowed to prevent hacking"); return(false); } if (amount == 0) { return(true); } return(PlayerProfileManager.Instance.AddResources(resourceType, amount)); }