Example #1
0
 public void Activate() // for activate button
 {
     if (mixerInRange)
     {
         // UnityEngine.Debug.Log("Activate");
         if (!mixer.Activate())
         {
             GameObject.Find("UI ELEMENTS").FindInChildren("MoneyPopups")
             .GetComponent <MoneyPopupController>().CreatePopup(mixer.gameObject.transform.position + Vector3.up * 2f, "X", new Color(234f / 255f, 35f / 255f, 35f / 255f, 1));
         }
     }
     else if (marketInRange)
     {
         // UnityEngine.Debug.Log("Activate");
         if (market.SellInMarket(this, itemHeld))
         {
             isItemInHand    = false;
             itemHeld.amount = 0;
         }
         else
         {
             GameObject.Find("UI ELEMENTS").FindInChildren("MoneyPopups")
             .GetComponent <MoneyPopupController>().CreatePopup(market.gameObject.transform.position + Vector3.up * 2f, "X", new Color(234f / 255f, 35f / 255f, 35f / 255f, 1));
         }
     }
     else if (plotInRange)
     {
         if (isItemInHand)
         {
             plotController.ClearPlot();
             plotController.SetItem(itemHeld);
             plotController.StartGrowing();
             if (--itemHeld.amount < 1)
             {
                 isItemInHand    = false;
                 itemHeld.amount = 0; // just in case
             }
         }
         else
         {
             GameObject.Find("UI ELEMENTS").FindInChildren("MoneyPopups")
             .GetComponent <MoneyPopupController>().CreatePopup(plotController.gameObject.transform.position + Vector3.up * 2f, "X", new Color(234f / 255f, 35f / 255f, 35f / 255f, 1));
         }
     }
 }