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; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { m_Inventory.GiveItem(ItemType.NinjaPoints, 15); int currentLevel = SceneManager.GetActiveScene().buildIndex; // Assuming the boss is on every third level if (currentLevel % 3 == 0 || currentLevel == 20) { SaveLoadSystem_JamieG.SaveCheckpoint(currentLevel + 1); } if (currentLevel > 4 || currentLevel == 20) { vendingMachine.SetActive(true); Time.timeScale = 0f; VendingMachineMenu_Elliott.m_gameIsPaused = true; } else { ProgressToNextLevel(); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { m_inventory.GiveItem(m_item, m_itemQuantity); gameObject.SetActive(false); if (m_item == ItemType.Key || m_item == ItemType.LiftKey) { weaponUI.setKey(true); print("Yay"); } } }
/// <summary> /// normal way of enemy takign damage /// </summary> /// <param name="damage">amount of damage</param> private void NormalTakeDamage(float damage) { if (m_playerDetected == false) //if sneak damage { m_health -= damage * m_sneakDamageMultiplier; m_cameraShake.StartShake(); m_HitEffectElliott.StartHitEffect(true); m_inventory.GiveItem(ItemType.NinjaPoints, 1); } else { m_health -= damage; m_HitEffectElliott.StartHitEffect(false); } }
//void UIEnable() //{ // if (!gameObject.activeInHierarchy) // { // foreach (var UI_object in m_UI) // { // UI_object.SetActive(true); // } // } //} void Start() { Inventory = GameObject.FindObjectOfType <Inventory_JoaoBeijinho>(); Inventory.GiveItem(ItemType.NinjaPoints, 40); }