void Start() { // PauseManager requires the EventSystem - make sure there is one if (FindObjectOfType <EventSystem>() == null) { var es = new GameObject("EventSystem", typeof(EventSystem)); es.AddComponent <StandaloneInputModule>(); } pausableInterfaces = pausable.GetComponents(typeof(IPausable)); quittableInterfaces = pausable.GetComponents(typeof(IQuittable)); _TimePause = gameObject.GetComponent <TimePause>(); anim = pauseCanvas.GetComponent <Animator>(); pauseCanvas.enabled = false; GameOverCanvas.enabled = false; WinGameCanvas.enabled = false; }
void Start() { // PauseManager requires the EventSystem - make sure there is one if (FindObjectOfType<EventSystem>() == null) { var es = new GameObject("EventSystem", typeof(EventSystem)); es.AddComponent<StandaloneInputModule>(); } pausableInterfaces = pausable.GetComponents(typeof(IPausable)); quittableInterfaces = pausable.GetComponents(typeof(IQuittable)); _TimePause = gameObject.GetComponent<TimePause>(); anim = pauseCanvas.GetComponent<Animator>(); pauseCanvas.enabled = false; GameOverCanvas.enabled = false; WinGameCanvas.enabled = false; }
public void BindToStory() { currentStory.BindExternalFunction <string, bool>("setGUIVisible", (name, value) => { currentBindings.SetGUIVisible(name, value); return(true); }); currentStory.BindExternalFunction <string, float, float>("createObject", (objectName, x, y) => { return(currentBindings.CreateObject(objectName, x, y)); }); currentStory.BindExternalFunction <string, float, float>("lookAt", (objectName, x, y) => { currentBindings.LookAt(objectName, x, y); }); currentStory.BindExternalFunction <float, string>("setTimeout", (value, knot) => { currentBindings.SetTimeout(value, knot); return(true); }); currentStory.BindExternalFunction <string, bool>("useUnscaledTime", (objectName, value) => { currentBindings.UseUnscaledTime(objectName, value); return(true); }); currentStory.BindExternalFunction <float>("setTimeScale", (value) => { TimePause.SetUniformScale(value); return(true); }); currentStory.BindExternalFunction <bool>("setTextBoxVisible", (value) => { currentBindings.SetTextBoxVisible(value); return(true); }); currentStory.BindExternalFunction("getPlayerX", () => { GameObject gameObject = GameObject.FindWithTag("Player"); if (gameObject != null) { return(gameObject.transform.position.x); } else { return(0.0f); } }); currentStory.BindExternalFunction("getPlayerY", () => { GameObject gameObject = GameObject.FindWithTag("Player"); if (gameObject != null) { return(gameObject.transform.position.y); } else { return(0.0f); } }); currentStory.BindExternalFunction <string>("getCharacterX", (character) => { GameObject gameObject = currentBindings.GetObjectNamed(character); if (gameObject != null) { return(gameObject.transform.position.x); } else { return(0.0f); } }); currentStory.BindExternalFunction <string>("getCharacterY", (character) => { GameObject gameObject = currentBindings.GetObjectNamed(character); if (gameObject != null) { return(gameObject.transform.position.y); } else { return(0.0f); } }); currentStory.BindExternalFunction <string, string, string>("playCards", (playerName, returnTo, returnKnot) => { CardGameInitializer.PlayCards(playerName, returnTo, returnKnot); return(true); }); currentStory.BindExternalFunction <string>("showStore", (storeName) => { currentBindings.ShowStore(storeName); return(true); }); currentStory.BindExternalFunction <int, string>("useSpinner", (digits, name) => { currentBindings.UseSpinner(digits, name); return(true); }); }
public void ExitStore() { Destroy(gameObject); TimePause.UnscaleTime(0.0f); }
private void Start() { UseStore(null); TimePause.ScaleTime(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(); }