// Increases BusinessState's resources by the price public static void RefundPlayerIngredients(this PotionType PotionType) { FeatherAndCount[] price = PotionType.GetIngredients(); // Increase funds for (int r = 0; r < price.Length; r++) { GameData.singleton.feathersOwned[(int)price[r].type] += price[r].count; } }
// Compares the ingredients to make a product with the BusinessState's resources public static bool PlayerHasIngredients(this PotionType PotionType) { FeatherAndCount[] price = PotionType.GetIngredients(); if (price.Length == 0) { // Don't let the player buy anything that is free (to avoid infinite loops) return(false); } for (int r = 0; r < price.Length; r++) { if (GameData.singleton.feathersOwned[(int)price[r].type] < price[r].count) { return(false); } } return(true); }