public void CompleteQuest() { SFXManager.SharedInstance.PlaySFX(SFXType.SoundType.M_END); questManager = FindObjectOfType <QuestManager>(); questManager.ShowQuestText(title + "\n" + completeText); if (givesReward) { int i = 0; foreach (string type in rewardType) { if (type == "Accesory") { accManager = FindObjectOfType <AccesoryManager>(); notInInventory = accManager.GetAllNotInInvetoryAccesory(); foreach (GameObject nacc in notInInventory) { if (nacc.GetComponent <Accesory>().accesoryName == rewardName[i]) { nacc.GetComponent <Accesory>().inInventory = true; } } } if (type == "Skills") { FindObjectOfType <UIManager>().ActivateSkillPanel(); } if (type == "Money") { FindObjectOfType <MoneyManager>().AddMoney(moneyValue); } i++; } } questCompleted = true; if (nextQuest != null) { Invoke("ActivateNextQuest", 5.0f); } gameObject.SetActive(false); //Desactiva la quest y ya no es repetible }
private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.tag.Equals("Player") && Input.GetMouseButtonDown(1)) { if (PlayerPrefs.GetString(chestID) == "closed") { _animator.SetBool("isOpened", true); PlayerPrefs.SetString(chestID, "opened"); itemsManager.chestsDict.Add(chestID, "opened"); Debug.Log(itemsManager.chestsDict[chestID]); SFXManager.SharedInstance.PlaySFX(SFXType.SoundType.RECEIVE_ITEM); dialogueManager.ShowDialogue(new string[] { "Chest: \n" + chestText }, rewardSprite); if (rewardType == "Gold") { moneyManager.AddMoney(goldValue); } if (rewardType == "QuestItem") { itemsManager.AddQuestItem(questItem.GetComponent <QuestItem>().itemName); } if (rewardType == "Potion") { itemsManager.AddPotions(1); } if (rewardType == "Ether") { itemsManager.AddEthers(1); } if (rewardType == "PD") { itemsManager.AddPD(1); } if (rewardType == "Weapon") { notInInventory = weaponManager.GetAllNotInInvetoryWeapons(); foreach (GameObject nweapon in notInInventory) { if (nweapon.GetComponent <WeaponDamage>().weaponName == rewardWeaponName) { nweapon.GetComponent <WeaponDamage>().inInventory = true; } } } if (rewardType == "Armor") { notInInventory = armorManager.GetAllNotInInvetoryArmors(); foreach (GameObject narmor in notInInventory) { if (narmor.GetComponent <Armor>().armorName == rewardWeaponName) { narmor.GetComponent <Armor>().inInventory = true; } } } if (rewardType == "Accesory") { notInInventory = accManager.GetAllNotInInvetoryAccesory(); foreach (GameObject nacc in notInInventory) { if (nacc.GetComponent <Accesory>().accesoryName == rewardWeaponName) { nacc.GetComponent <Accesory>().inInventory = true; } } } } } }