예제 #1
0
        private static void Demolish(GameLocation location, Object machine)
        {
            string craftingRecipeRaw;

            if (!CraftingRecipe.craftingRecipes.TryGetValue(machine.Name, out craftingRecipeRaw))
            {
                return;
            }

            var craftingRecipe = CraftingRecipeInformation.Parse(craftingRecipeRaw);
            var debrisLocation = machine.TileLocation * Game1.tileSize + new Vector2(Game1.tileSize / 2f, Game1.tileSize / 2f);

            foreach (var ingredient in craftingRecipe.Materials)
            {
                location.debris.Add(new Debris(new SmartObject(ingredient.ID, ingredient.Count), debrisLocation));
            }
            if (machine.heldObject != null && machine.readyForHarvest)
            {
                location.debris.Add(new Debris(machine.heldObject, debrisLocation));
            }
            location.removeObject(machine.TileLocation, false);
        }
예제 #2
0
        private static void TestParsing(string value)
        {
            var craftingRecipeInformation = CraftingRecipeInformation.Parse(value);

            Assert.AreEqual(value, craftingRecipeInformation.ToString());
        }