/// <summary> /// Handle choosing which popup to show and updating the popups with the correct information /// </summary> private void handlePopup() { LogicStep currLogicStep = logicSteps[currStep]; if (currLogicStep.GetClue() != null) { // show clues popup clueOffset = 0; CluesPopup.SetActive(true); string[] stepString = Parser.SplitLogicDialogue(currDialogue[currDialogueIndx]); Question.text = stepString[1]; updateCluesPopup(); EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(ClueNames[0].gameObject); currClueName = clues[0]; updateCluesDescription(); } else { // show choices popup updateChoicesPopup(); } }
private void updateLogicStep() { LogicStep currLogicStep = logicSteps[currStep]; currDialogue = currLogicStep.GetDialogue(); currDialogueIndx = 0; updateDialogue(); // if there is a clue or choice to be made, cannot go to next logic step showPopup = currLogicStep.GetClue() != null || currLogicStep.GetCorrectChoice() > -1; }
/// <summary> /// Select a clue /// </summary> /// <param name="clueIndex">Index of the clue</param> public void SelectClue(int clueIndex) { if (clueIndex < ClueNames.Length) { wrongAnswer = false; string clueName = ClueNames[clueIndex].text; Clue selectedClue = GameManager.Instance.GetClueWithName(chapterName, clueName); LogicStep currLogicStep = logicSteps[currStep]; CluesPopup.SetActive(false); showPopup = false; if (!currLogicStep.GetClue().IsEqual(selectedClue)) { // selected wrong clue wrongAnswer = true; updateWrongDialogue(); } } }
/// <summary> /// Determine if the step is selecting a clue /// </summary> /// <param name="logicStep">Step of the Logic System</param> /// <returns>True if is selecting a clue, false otherwise</returns> public static bool IsSelectingClue(LogicStep logicStep) { return(logicStep.GetClue() != null); }
/// <summary> /// Determine if the player selected the correct Clue /// </summary> /// <param name="selectedClue">Clue that the player selected</param> /// <param name="logicStep">Step of the Logic System</param> /// <returns>True if the Clue is the correct one, false otherwise</returns> public static bool DidSelectCorrectClue(Clue selectedClue, LogicStep logicStep) { return(logicStep.GetClue().IsEqual(selectedClue)); }