public void ExitStore() { Destroy(gameObject); TimePause.UnscaleTime(0.0f); }
public IEnumerator interact(string storyEntryPoint) { TimePause.ScaleTime(0.0f); Time.timeScale = 0.0f; prefabInstance = Instantiate <TextDialog>(textPrefab); Story story = StoryManager.GetSingleton().GetStory(); story.ChoosePathString(storyEntryPoint, new string[] { }); do { string storyText = story.Continue(); List <Choice> choices = story.currentChoices; string[] parts = prefabInstance.SplitSections(storyText, choices.Count + (spinnerParams != null ? 1 : 0)); if (delayTime > 0.0f && timeoutKnot != null) { yield return(new WaitForSecondsRealtime(delayTime)); delayTime = 0.0f; } prefabInstance.Reset(); if (storyText.Trim() == "[...]") { continue; } foreach (string part in parts) { prefabInstance.text.text = part; if (part == parts[parts.Length - 1] && spinnerParams != null) { prefabInstance.ShowNumberSpinner(spinnerParams.GetValueOrDefault()); spinnerParams = null; } if (choices.Count > 0 && part != parts[parts.Length - 1] || choices.Count == 0) { while (!Input.GetButtonDown("Submit")) { yield return(null); } while (!Input.GetButtonUp("Submit")) { yield return(null); } } } if (choices.Count > 0) { prefabInstance.ShowOptions(choices); int currentSelection = 0; while (!Input.GetButtonDown("Submit")) { if (Input.GetButtonDown("Next") && currentSelection < choices.Count - 1) { currentSelection++; } if (Input.GetButtonDown("Previous") && currentSelection > 0) { currentSelection--; } prefabInstance.Select(currentSelection); yield return(null); } if (currentSelection < choices.Count) { story.ChooseChoiceIndex(choices[currentSelection].index); if (story.canContinue) { story.Continue(); } } while (!Input.GetButtonUp("Submit")) { yield return(null); } } prefabInstance.ResetSpinner(); }while (story.canContinue); Destroy(prefabInstance.gameObject); TimePause.UnscaleTime(0.0f); Time.timeScale = 1.0f; if (timeoutKnot != null) { string toKnot = timeoutKnot; timeoutKnot = null; yield return(interact(toKnot)); } CardGameInitializer.Commit(); }