Example #1
0
 static void Main(string[] args)
 {
     List<Item> recipeItems = new List<Item>() 
         { 
             new Item { Name = "Sword" } ,
             new Item { Name = "Magic Stone" }
         }; 
     Item outputItem = new Item() { Name ="Super magic sword" }; 
     Inventory inventory = new Inventory() 
         { 
             new Item { Name = "Sword" } ,
             new Item { Name = "Ring" },
             new Item { Name = "Magic Stone" }
         };
     CraftingRecipe craftingRecipe =
         new CraftingRecipe(recipeItems, outputItem);
     var newlyCraftedItem = craftingRecipe.CraftItem(inventory);
     if (newlyCraftedItem != null)
     {
         Console.WriteLine(newlyCraftedItem.Name);
     }
     else
     {
         Console.WriteLine("Your item has not been crafted"); 
     }
     Console.Read(); 
 }