Esempio n. 1
0
 public void afterMoveEvent()
 {
     crafter = new Crafter();
     Debug.Log("Checking if craft is possible...");
     if (_CraftResultListController.isEmpty())
     {
         // check if craft is possible
         var iResources = _craftListController.getIResources();
         if (crafter.canBeCrafted(iResources))
         {
             Debug.Log("Craft is posiible, enabling craft button...");
             craftButton.SetActive(true);
         }
         else
         {
             craftButton.SetActive(false);
         }
     }
 }
Esempio n. 2
0
 /**
  * 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);
         }
     }
 }