public void BuyCard(ShopCard item) { if (resources.GetValue(EResources.GOLD) >= item.price) { resources.AddResources(EResources.GOLD, -item.price); library.AddCard(item.card.Clone(), memoriesPile); } }
/// <summary> /// Add a resource to the player's inventory /// </summary> /// <param name="type"> The resource's type </param> /// <param name="value"> The resource's quantity </param> void AddResourceToPlayerInv(ResourceType type, int value) { // Call the "AddResources" function in the ResourcesManager's script to add the resource to the player's inventory resourcesManagerScript.AddResources(type, value); // Call the "RemoveActualResource" function in the CharactersManager's script to remove the target on this resource charactersManagerScript.RemoveActualResource(); // Destroy this GameObject (the resource) Destroy(this.gameObject); }