/// <summary> /// Called by PlayerActivate when clicking on this GameObject. /// </summary> public void DoClick() { // Set click on resource if (targetResource != null) { // Set the click on resource targetResource.SetPlayerClicked(); // Give item to player and hide resource if (targetResource is Item) { TransferWorldItemToPlayer(); } } }
/// <summary> /// Called by PlayerActivate when clicking on this GameObject. /// </summary> /// <returns>True if this resource was found in any active quests.</returns> public bool DoClick() { bool foundInActiveQuest = false; // Handle linked resource if (targetResource != null) { // Click resource targetResource.SetPlayerClicked(); // If this an item then transfer item to player and hide resource if (targetResource is Item) { TransferWorldItemToPlayer(); } foundInActiveQuest = true; } // Possible for NPC to start a direct follow-up quest and new quest needs a bootstrap click // But if resource is still associated with old quest from previous layout then click never sent to new quest // So if behaviour is peered with an individual StaticNPC then send click to all quests using this NPC // This allows new quest to receive click and NPC will be re-linked on next layout or by "add NPC as questor" StaticNPC npc = GetComponent <StaticNPC>(); if (npc) { int factionID = npc.Data.factionID; if (QuestMachine.Instance.IsIndividualNPC(factionID)) { foundInActiveQuest = ClickAllIndividualNPCs(factionID); } } return(foundInActiveQuest); }