private void OnMouseDown() { if (GameManager_Singleton.Instance.canPlay == false) { return; } if (wait) { return; } if (Vector3.Distance(GameManager_Singleton.Instance.Player.transform.position, this.gameObject.transform.position) > 7) { return; } wait = true; if (coletado2 != null) { coletado1.Play(); coletado2.Play(); } else { coletado1.Play(); } for (int i = 0; i < quantity; i++) { SaveLoad.AddItemOnInventory(indiceItemTabela); } Invoke("selfDestruct", 0.5f); //SaveLoad.inventoryData.ad }
public void completeQuest() { if (isDecreaseType) { foreach (SaveLoad.Item element in SaveLoad.inventoryData) { if (element.ID == decreseitemID) // tem item { if (element.AMOUNT >= qtdD) // quantidade do item é a requerida { for (int i = 0; i < qtdD; i++) { SaveLoad.RemoveItemOnInventory(decreseitemID); } } } } } if (isRewardType) { for (int i = 0; i < qtdR; i++) { SaveLoad.AddItemOnInventory(rewardItemID); } GameManager_Singleton.Instance.IconManager.showAnimReceiveReward(IconeQuest); } else if (isSolutionRewardType) { bool hassolution = false; foreach (SaveLoad.Solutions si in SaveLoad.solutionsData) { if (si.SolutionID_Class == questID) { hassolution = true; } } if (!hassolution) { SaveLoad.Solutions s = new SaveLoad.Solutions(); if (solutionTypeInstance == 0) { s.setDesc(SaveLoad.Solutions.solutionType.FossaVapotranspirante); } if (solutionTypeInstance == 1) { s.setDesc(SaveLoad.Solutions.solutionType.CirculoDeBananeira); } } } if (isCompletableQuest) { bool hasquest2 = false; foreach (SaveLoad.QuestID qid in SaveLoad.questData) { if (qid.QuestID_Class == questID) { hasquest2 = true; qid.qProgress = SaveLoad.QuestID.questProgress.Completed; } } if (!hasquest2) { Debug.Log("ERROR: Quest Not Found."); } } SaveLoad.Save(); }