void Update() { if (currentQuest != null) { questUIPrompt(currentQuest); } if (currentTrader != null) { tradeUIPrompt(currentTrader); } if (interactable && Input.GetKeyDown(KeyCode.Mouse0) && npcmanager.currentNpc != null) { resetIndicator(); if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 0)) { currentQuest = (NPCManager.QuestInfo)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 0); questUIPrompt(currentQuest); } else if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 1)) { questStatusCheck((NPCManager.QuestInfo)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 1)); } else if (npcmanager.returnNPCType(npcmanager.currentNpc.NPC, 2)) { currentTrader = (NPCManager.Trader)npcmanager.returnNPCData(npcmanager.currentNpc.NPC, 2); traderInfo = currentTrader; tradeUIPrompt(currentTrader); } //local data record if (!recorded) { if (npcmanager.currentNpc.npcType == "Human") { GetComponent <gsheet_data>().sendData(3, 1); } else if (npcmanager.currentNpc.npcType == "Animal") { GetComponent <gsheet_data>().sendData(4, 1); } //local data record DataRecord.AddEvents(9, npcmanager.currentNpc.NPC.name); recorded = true; } } if (npcmanager.currentNpc == null) { recorded = false; } showQuestIndicator(); }
void Plow() { overlay.sprite = null; FxManager.PlayMusic("PlowFx"); needsPlowing = false; //local data record DataRecord.AddEvents(2, this.gameObject.name); }
public void accept() { Accepted = true; //local data record if (currentQuest != null) { DataRecord.AddEvents(7, currentQuest.name + " Quest"); } }
public void PopFishingGame() { FxManager.PlayMusic("FishingFx"); canInteract = false; fishingGame.SetActive(true); PlayerMovement.canMove = false; GetFishSprite(); //local data record DataRecord.AddEvents(6, "Fishing"); }
void Harvest() { if (canInteract && cropState == CropStateTest.Done && !feedback.harvested) { if (Input.GetKeyDown(KeyCode.Mouse0)) { foreach (Item item in itemDatabase.database) { if ((item.itemName + "(Clone)") == this.gameObject.name) { ni.questItemCheck(item); inventory.AddItem(item.id); // Quest item check foreach (NPCManager.QuestInfo q in player.GetComponent <NPCInteraction>().acceptedQuestLists) { foreach (NPCManager.NPCItem it in q.requirement) { if ((it.objectName + "(Clone)") == this.gameObject.name) { it.collected += 1; } } } this.gameObject.transform.parent.GetComponent <DirtTile>().needsPlowing = true; this.gameObject.transform.parent.GetComponent <DirtTile>().AddDirt(); //local data record DataRecord.AddEvents(5, this.gameObject.name); //set harvested for feedback feedback.harvested = true; feedback.itemImage.sprite = sr.sprite; feedback.itemText.text = item.itemName; //For tutorial purpose if (!TutorialManager.doneTutorial) { tutorial.harvestCount += 1; } // gsheet data record player.GetComponent <gsheet_data>().sendData(1, 1); Destroy(this.gameObject); break; } } } canInteract = false; } }
void CropStateChange() { if (planted && cropState == CropStateTest.Seed) { cropState = CropStateTest.Planted; //planted = false; //local data record DataRecord.AddEvents(3, this.gameObject.name); } if (cropState == CropStateTest.Planted) { duration += Time.deltaTime; if (duration >= 1) { growPercentage += growthRate; duration = 0; } } if (cropState == CropStateTest.Delayed) { duration += Time.deltaTime; if (duration >= 1) { growPercentage += 0; duration = 0; } } if (growPercentage != 0 && growPercentage != 100 && growPercentage % waterRate == 0) { cropState = CropStateTest.Delayed; waterIndicator.SetActive(true); if (watered) { cropState = CropStateTest.Planted; waterIndicator.SetActive(false); } } if (growPercentage % waterRate != 0) { watered = false; } if (growPercentage >= 100) { cropState = CropStateTest.Done; } }
void spawnFish() { //if (fishType == FishTypeTest.Catfish) //{ // temp = Instantiate(fishObject[0], player.transform.position, Quaternion.identity); //} //if (fishType == FishTypeTest.Salmon) //{ // temp = Instantiate(fishObject[1], player.transform.position, Quaternion.identity); //} //if(fishType == FishTypeTest.Sardine) //{ // temp = Instantiate(fishObject[2], player.transform.position, Quaternion.identity); //} // if(fishType == FishTypeTest.Tuna) //{ // temp = Instantiate(fishObject[3], player.transform.position, Quaternion.identity); //} foreach (Item item in itemDatabase.database) { if ((item.itemName) == fishNames.text) { ni.questItemCheck(item); inventory.AddItem(item.id); //Quest item check foreach (NPCManager.QuestInfo q in GameObject.FindGameObjectWithTag("Player").GetComponent <NPCInteraction>().acceptedQuestLists) { foreach (NPCManager.NPCItem it in q.requirement) { if ((it.objectName) == this.gameObject.name) { it.collected += 1; } } } //gsheet data record Player.LocalPlayerInstance.GetComponent <gsheet_data>().sendData(0, 1); //local data record DataRecord.AddEvents(0, fishImg.sprite.name); break; } } }
void questStatusCheck(NPCManager.QuestInfo q) { int count = 0; if (q != null) { foreach (NPCManager.NPCItem i in q.requirement) { if (i.collected >= i.amount) { count++; } } if (count == q.requirementCount) { resetIndicator(); QuestLog log = new QuestLog(); q.completed = true; log.questID = q.id; log.questName = q.name; log.questDetail = q.detail; log.reward = q.reward; log.completed = q.completed; StartCoroutine(q.DelayReset(2f)); completedQuestLists.Add(log); acceptedQuestLists.Remove(q); questUICompletion.SetActive(true); //questUICompletion.GetComponentInChildren<Text>().text = "Quest Completed ! \n" + "Rewarded " + log.reward + " Gold"; //local data record DataRecord.AddEvents(10, q.name + " Quest"); StartCoroutine(closeUI(2f)); } } }
public void decline() { if (currentTrader != null) { //local data record DataRecord.AddEvents(8, "Trader " + currentTrader.name + "'s Trade"); currentTrader.accepted = false; } //local data record if (currentQuest != null) { DataRecord.AddEvents(8, currentQuest.name + " Quest"); } Accepted = false; questUI.SetActive(false); tradeUI.SetActive(false); currentQuest = null; currentTrader = null; traderInfo = null; PlayerMovement.canMove = true; }
void WaterCrops() { if (canInteract && cropState == CropStateTest.Delayed) { if ((Input.GetKeyDown(KeyCode.Mouse0)) && HotKey.canUse && HotKey.canWater) { WaterCan.curFill -= 1; waterIndicator.SetActive(false); FxManager.PlayMusic("WaterFx"); watered = true; canInteract = false; //For tutorial if (!TutorialManager.doneTutorial) { tutorial.waterCount += 1; } //local data record DataRecord.AddEvents(4, this.gameObject.name); } } }