public void UpdateTextStep() { // Add to the story text if we can type more letters if (storyText.text.Length < targetStoryText.Length) { // Print the whole tag at once for rich text var nextChar = targetStoryText[storyText.text.Length]; if (nextChar == '<') { while (nextChar != '>') { storyText.text += nextChar; nextChar = targetStoryText[storyText.text.Length]; } // do it one more time storyText.text += nextChar; nextChar = targetStoryText[storyText.text.Length]; } //Debug.Log("Adding character " + targetStoryText[storyText.text.Length]); storyText.text += targetStoryText[storyText.text.Length]; if (targetStoryText[storyText.text.Length - 1] == ' ') { //Debug.Log("SPACE"); //}else if(targetStoryText[storyText.text.Length] == "\n\n"){ } else { soundEngine.PlaySoundWithName("Text"); } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space)) { soundEngine.PlaySoundWithName("Enter"); SceneManager.LoadScene("Menu"); } }
void PerformPlayerControlledMovement() { if (currentBlock == null) { return; } if (Input.GetButtonDown("rotateclockwise")) { currentBlock.RotateClockwise(tetrisBoard); soundEngine.PlaySoundWithName("BlockRotate"); } if (Input.GetButtonDown("rotatecounterclockwise")) { currentBlock.RotateCounterClockwise(tetrisBoard); soundEngine.PlaySoundWithName("BlockRotate"); } if (Input.GetButtonDown("left")) { currentBlock.MoveLeft(tetrisBoard); soundEngine.PlaySoundWithName("BlockMove"); } if (Input.GetButtonDown("right")) { currentBlock.MoveRight(tetrisBoard); soundEngine.PlaySoundWithName("BlockMove"); } if (Input.GetButtonDown("up")) { currentBlock.MoveDownMax(tetrisBoard); } else if (Input.GetButtonDown("down")) { PerformNextDownwardMove(); soundEngine.PlaySoundWithName("BlockMove"); } if (Input.GetButtonDown("stash")) { StashCurrentBlock(); } display.UpdateBoard(tetrisBoard, currentBlock); }
// Update is called once per frame void Update() { // Do nothing if the string is empty if (fullTextStr.Length == 0) { return; } // Don't start typing unless we've passed the delay time typeTimer += Time.deltaTime; if (!delayPassed) { if (typeTimer >= typeDelay) { delayPassed = true; typeTimer -= typeDelay; } } else { if (typeTimer >= typeSpeed) { typeTimer -= typeSpeed; text.text += fullTextStr[0]; if (fullTextStr[0] == ' ') { //Debug.Log("Print [space]"); /*}else if(fullTextStr[0] == '|'){ * soundEngine.PlaySoundWithName("Dash");*/ } else { //Debug.Log("printing [" + fullTextStr[0] + "]"); soundEngine.PlaySoundWithName(sound); } fullTextStr = fullTextStr.Substring(1); if (fullTextStr.Length == 0) { BroadcastMessage("OnTypingAnimationCompleted", SendMessageOptions.DontRequireReceiver); } } } }
void TitleEnter() { Debug.Log("Title ENTER"); twineTextPlayer = Object.FindObjectOfType <TwineTextPlayer>(); if (twineTextPlayer != null) { Debug.Log("TwineTextPlayer found"); } else { Debug.Log("TwineTextPlayer NOT found"); } if (soundEngine != null) { soundEngine.PlaySoundWithName("ImproperShutdown"); //soundEngine.PlaySoundWithName("FirstText"); } if (musicEngine != null) { Debug.Log("Getting current music snapshot"); musicEngine.mixerSnapshots[0].TransitionTo(musicEngine.pauseTransitionTime); musicEngine.currentMusicSnapshot = musicEngine.mixerSnapshots[2]; } }
// Update is called once per frame void Update() { if (EventSystem.current.currentSelectedGameObject == null) { EventSystem.current.SetSelectedGameObject(lastSelect); } else { lastSelect = EventSystem.current.currentSelectedGameObject; } if (Input.GetButtonDown("down")) { if (curIndex < textList.Length - 1 && currentScene == SceneManager.GetSceneByName("Options")) { textList[curIndex].color = lime; if (curIndex == 2) { cursor.transform.position += Vector3.down * 72; foreach (Slider s in sliders) { s.interactable = false; } } curIndex++; Debug.Log(textList[curIndex].text + ", " + curIndex); cursor.transform.position += Vector3.down * cursorOffset; textList[curIndex].color = Color.white; soundEngine.PlaySoundWithName("MenuNav"); } if (curIndex < textList.Length - 1 && currentScene == SceneManager.GetSceneByName("Menu")) { textList[curIndex].color = lime; curIndex++; cursor.transform.position += Vector3.down * cursorOffset; textList[curIndex].color = Color.white; Debug.Log(textList[curIndex].text + ", " + curIndex + ", " + cursor.transform.position.ToString()); soundEngine.PlaySoundWithName("MenuNav"); } } if (Input.GetButtonDown("up")) { if (curIndex >= 1) { textList[curIndex].color = lime; if (curIndex == 3 && currentScene == SceneManager.GetSceneByName("Options")) { cursor.transform.position += Vector3.up * 72; foreach (Slider s in sliders) { s.interactable = true; } sliders[2].Select(); } curIndex--; Debug.Log(textList[curIndex].text + ", " + curIndex); textList[curIndex].color = Color.white; cursor.transform.position += Vector3.up * cursorOffset; soundEngine.PlaySoundWithName("MenuNav"); } } if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Space)) { soundEngine.PlaySoundWithName("Enter"); if (currentScene == SceneManager.GetSceneByName("Menu")) { if (curIndex == 0) { SceneManager.LoadScene("Game"); } if (curIndex == 1) { SceneManager.LoadScene("Options"); } if (curIndex == 2) { SceneManager.LoadScene("Credits"); } } if (currentScene == SceneManager.GetSceneByName("Options")) { if (curIndex == 3) { SceneManager.LoadScene("Game"); } if (curIndex == 4) { SceneManager.LoadScene("Menu"); } if (curIndex == 5) { SceneManager.LoadScene("Credits"); } } } //Slider SFX if (curIndex >= 0 && curIndex <= 2) { if (Input.GetKeyDown(KeyCode.LeftArrow)) { Debug.Log("Left Arrow"); for (int i = 0; i <= sliders.Length - 1; i++) { Slider slider = sliders[i]; if (slider.gameObject == EventSystem.current.currentSelectedGameObject) { if (slider.value > slider.minValue) { if (!sliderMinReached[i]) { soundEngine.PlaySoundWithName("MenuNavSub"); } sliderMaxReached[i] = false; } else if (!sliderMinReached[i]) { soundEngine.PlaySoundWithName("MenuNavSub"); sliderMinReached[i] = true; } } } } else if (Input.GetKeyDown(KeyCode.RightArrow)) { Debug.Log("Right Arrow"); for (int i = 0; i <= sliders.Length - 1; i++) { Slider slider = sliders[i]; if (slider.gameObject == EventSystem.current.currentSelectedGameObject) { if (slider.value < slider.maxValue) { soundEngine.PlaySoundWithName("MenuNavSub"); sliderMinReached[i] = false; } else if (!sliderMaxReached[i]) { soundEngine.PlaySoundWithName("MenuNavSub"); sliderMaxReached[i] = true; } } } } } }