/** * Attempts to make craft. If successful - resources from the craft area will be wasted for a new resourse */ public void craft() { Debug.Log("Start crafting"); // TODO check for empty of the craft result before any craft if (_CraftResultListController.isEmpty()) { // check if craft is possible var iResources = _craftListController.getIResources(); Debug.Log("Check if can be crafted..."); if (crafter.canBeCrafted(iResources)) { Debug.Log("Crafting..."); var result = crafter.craft(iResources); // removing resources that were wasted for craft operation _craftListController.clear(); // updating resources bar resourceManager.wasteResources(iResources); // inserting resource to craft result bar _CraftResultListController.appendResource(result); // updating resource bar resourceManager.addResource(result); } } }