public void PurchaseUpgrade()
 {
     if (SelectPizza.activeInHierarchy && Inventory.HasItem(ItemType.NinjaPoints, 15))
     {
         Debug.Log("Tempura");
         Inventory.RemoveItem(ItemType.NinjaPoints, 15);
         Inventory.GiveItem(ItemType.Tempura, 1);
     }
     else if (SelectCookie.activeInHierarchy && !PurchasedCookie && Inventory.HasItem(ItemType.NinjaPoints, 50))
     {
         Debug.Log("Dango");
         Inventory.RemoveItem(ItemType.NinjaPoints, 50);
         Inventory.GiveItem(ItemType.Dango, 1);
         CookieColor.color = Color.red;
         PurchasedCookie   = true;
     }
     else if (SelectSake.activeInHierarchy && Inventory.HasItem(ItemType.NinjaPoints, 25))
     {
         Debug.Log("sake");
         Inventory.RemoveItem(ItemType.NinjaPoints, 25);
         Inventory.GiveItem(ItemType.Sake, 1);
     }
     else if (SelectNoodle.activeInHierarchy && !PurchasedNoodle && Inventory.HasItem(ItemType.NinjaPoints, 50)) /*&& ninja point >= 50*/
     {
         Debug.Log("noodles");
         Inventory.RemoveItem(ItemType.NinjaPoints, 50);
         Inventory.GiveItem(ItemType.Noodles, 1);
         NoodleColor.color = Color.red;
         PurchasedNoodle   = true;
     }
 }
Beispiel #2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.CompareTag(Tags_JoaoBeijinho.m_playerTag) && m_inventory.HasItem(itemNeeded, m_keysRequired))//Collision with Player and key check in inventory
     {
         gameObject.SetActive(false);
         m_inventory.RemoveItem(ItemType.Key, m_keysRequired);
         weaponUI.setKey(true);
     }
 }
 private void Image_Click()
 {
     if (m_LeftClick.m_attackTap.enabled)
     {
         RaycastHit hit;
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 100.0f))
         {
             if (hit.collider.gameObject.transform.position == Noodles.transform.position)
             {
                 if (m_InvScript.HasItem(ItemType.NinjaPoints, 50))
                 {
                     //{ remove squid food, replace with noodles
                     m_InvScript.RemoveItem(ItemType.NinjaPoints, 50);
                 }
             }
             if (hit.collider.gameObject.transform.position == Sake.transform.position)
             {
                 if (m_InvScript.HasItem(ItemType.NinjaPoints, 25))
                 {
                     // call sake action
                     m_InvScript.RemoveItem(ItemType.NinjaPoints, 25);
                     wpnUI.setPickupImage(FoodType.SAKE);
                     wpnUI.setPickupAnim(true);
                 }
             }
             if (hit.collider.gameObject.transform.position == Tempura.transform.position)
             {
                 wpnUI.setPickupImage(FoodType.TEMPURA);
                 wpnUI.setPickupAnim(true);
             }
             if (hit.collider.gameObject.transform.position == Dango.transform.position)
             {
                 if (m_InvScript.HasItem(ItemType.NinjaPoints, 50))
                 {
                     //call dango action
                     m_InvScript.RemoveItem(ItemType.NinjaPoints, 50);
                 }
             }
         }
     }
 }