void Update() { if (Input.GetButtonDown("Vertical")) { if (Input.GetAxisRaw("Vertical") > 0) { if (select > SelectState.Start) { select--; } Debug.Log(select); AudioManager.AudioPlay(MenuMove); } else if (Input.GetAxisRaw("Vertical") < 0) { if (select < SelectState.Quit) { select++; } Debug.Log(select); AudioManager.AudioPlay(MenuMove); } } if (Input.GetButtonDown("Submit")) { AudioManager.AudioPlay(MenuSelect); if (select == SelectState.Start) { fadeController.FadeOut(0.5f, () => { SceneManager.LoadScene("MainScene"); }); } else if (select == SelectState.Quit) { fadeController.FadeOut(0.5f, () => { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #elif UNITY_WEBPLAYER Application.OpenURL("http://google.com"); #else Application.Quit(); #endif }); } } switch (select) { case SelectState.Start: titleStartMenu.GetComponent <SpriteRenderer>().sprite = startSelected; titleQuitMenu.GetComponent <SpriteRenderer>().sprite = quit; break; case SelectState.Quit: titleStartMenu.GetComponent <SpriteRenderer>().sprite = start; titleQuitMenu.GetComponent <SpriteRenderer>().sprite = quitSelected; break; } }
IEnumerator Fanfare_() { _musicPlayer.FadeIn(3f); yield return(new WaitForSeconds(4)); _musicPlayer.PlayCredits(); var playerHUD = GameObject.Find("UI/Player"); var progressionHUD = GameObject.Find("UI/ProgressionBar"); yield return(StartCoroutine(_uiController.ShowFanfare())); IEnumerable <FadeController> faders = new List <FadeController> (); faders = faders.Concat(playerHUD.GetComponents <FadeController> ()); faders = faders.Concat(progressionHUD.GetComponents <FadeController> ()); faders = faders.Concat(playerHUD.GetComponentsInChildren <FadeController> ()); faders = faders.Concat(progressionHUD.GetComponentsInChildren <FadeController> ()); faders.ToList().ForEach(_ => StartCoroutine(_.FadeIn(1f, true))); yield return(StartCoroutine(_blackScreenFadeController.FadeOut(1f, 0.5f, true))); yield return(new WaitForSeconds(1f)); yield return(StartCoroutine(_uiController.ShowCredits())); yield return(new WaitForSeconds(2f)); yield return(StartCoroutine(_blackScreenFadeController.FadeOut(2f))); GameObject.Find("LevelManager").GetComponent <Level> ().LoadStartMenu(); }
private void Update() { if (!oneCall) { return; } minDistance = Vector3.Distance(transform.position, spawnSystem.GetChild(0).position); for (int i = 0; i < spawnSystem.childCount; i++) { if (i == 0) { minDistance = Vector3.Distance(transform.position, spawnSystem.GetChild(i).position); } if (Vector3.Distance(transform.position, spawnSystem.GetChild(i).position) < minDistance) { minDistance = Vector3.Distance(transform.position, spawnSystem.GetChild(i).position); spawn = i; } } if (minDistance > 10f) { StartCoroutine(fade.FadeOut()); if (spawn > 0) { StartCoroutine(Respawn(spawn - 1, true)); } else { StartCoroutine(Respawn(0, true)); } oneCall = false; } if (manual) { if (t < waitTime && bicycle.vertical > 0 && bicycle.bicycleSpeed < 1f && oneCall && SceneController.isPlay) { t += Time.deltaTime; if (t >= waitTime) { t = 0; oneCall = false; StartCoroutine(Respawn(spawn, true)); } } else { t = 0; } } float dis = Vector3.Distance(transform.position, finish.position); if (dis < distanceFinish && SceneController.isPlay) { SceneController.CanvasEnd(); SceneController.isPlay = false; StopAllCoroutines(); Invoke("Restart", 2f); } }
public IEnumerator StartGame() { canvas.enabled = false; yield return(fadeController.FadeOut(Color.black, fadeDuration)); SwitchToPlayer(); yield return(fadeController.FadeIn(fadeDuration)); }
void ToggleMenu(GameObject _menuObj) { //Toggle off all the menues if (PausePanel.activeSelf) { PausePanel.SetActive(false); } if (VictoryPanel.activeSelf) { VictoryPanel.SetActive(false); } if (DefeatPanel.activeSelf) { DefeatPanel.SetActive(false); } if (TutorialPanel.activeSelf) { TutorialPanel.SetActive(false); } //Toggle on only the desired one if (_menuObj) { _menuObj.SetActive(true); } fadeCtrl.FadeOut(); }
private void Update() { if (Input.anyKeyDown && m_fadeController.IsFinish) { m_fadeController.FadeOut(1.0f, Color.black, GotoScene); } }
private IEnumerator Quit() { FadeController.FadeOut(2f); yield return(new WaitForSeconds(2f)); Application.Quit(0); }
IEnumerator Activate() { m_fader.FadeOut(3.0f, () => { Debug.Log("Fade out"); }); yield return(null); }
void ToggleMenu(GameObject _menuObj) { //Toggle off all the menues if (MainMenuPanel.activeSelf) { MainMenuPanel.SetActive(false); } if (LevelSelectionPanel.activeSelf) { LevelSelectionPanel.SetActive(false); } if (CreditsPanel.activeSelf) { CreditsPanel.SetActive(false); } if (IntroPanel.activeSelf) { IntroPanel.SetActive(false); } if (TutorialPanel.activeSelf) { TutorialPanel.SetActive(false); } //Toggle on only the desired one _menuObj.SetActive(true); fadeCtrl.FadeOut(); }
IEnumerator loadLevel() { fadeController.FadeOut(); while (!fadeController.isDone) { yield return(null); } sceneFinished = false; if (SceneManager.GetActiveScene().name == "town.scene") { SceneManager.LoadScene("temple.scene"); } else if (SceneManager.GetActiveScene().name == "temple.scene") { SceneManager.LoadScene("house_monk-tinker-chat"); } else if (SceneManager.GetActiveScene().name == "house_monk-tinker-chat") { SceneManager.LoadScene("town2.scene"); } else if (SceneManager.GetActiveScene().name == "town2.scene") { SceneManager.LoadScene("performance.scene"); } else if (SceneManager.GetActiveScene().name == "town3.scene") { SceneManager.LoadScene("temple2.scene"); } else if (SceneManager.GetActiveScene().name == "temple2.scene") { SceneManager.LoadScene("Credits.scene"); } }
private IEnumerator HandleGameOverState() { if (gameOver) { yield break; } gameOver = true; yield return(fadeController.FadeIn(5f)); obstacleManager.StopSpawning(); player.SetActive(false); hand.SetActive(false); yield return(new WaitForSeconds(1)); player.SetActive(true); hand.SetActive(true); yield return(fadeController.FadeOut(50f)); obstacleManager.StartSpawning(); gameOver = false; }
IEnumerator ChangeDoor() { AudioSource.PlayOneShot(DoorSfx); yield return(StartCoroutine(_fadeController.FadeOut(0.35f))); _gameController.EnterDoor(_index); }
public IEnumerator ScreenFade(float fadeOutTime, float fadeInTime, Color screenColor) { yield return(fadeController.FadeOut(screenColor, fadeOutTime)); yield return(new WaitForSeconds(0.5f)); yield return(fadeController.FadeIn(fadeInTime)); }
private void Update() { if (Input.anyKeyDown && m_fadeController.IsFinish && !m_isFade) { m_isFade = true; m_fadeController.FadeOut(1.0f, Color.black, ShowText); } }
private IEnumerator DoTransition(SceneTransitionZone sceneTransition) { zoomSound.Play(); yield return(fadeController.FadeOut(Color.black, fadeDuration)); gameObject.transform.position = sceneTransition.target.spawnPoint; yield return(fadeController.FadeIn(fadeDuration)); }
IEnumerator Activate() { fader.FadeIn(3f); yield return(new WaitForSeconds(3f)); fader.FadeOut(2f, () => { UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("1_StartScene"); }); }
IEnumerator LoadSceneCR(int sceneIndex, float fadeOutTime, float fadeInTime) { FadeController.FadeOut(fadeOutTime); yield return(new WaitForSeconds(fadeOutTime)); SceneManager.LoadScene(sceneIndex); FadeController.FadeIn(fadeInTime); instance.changingScenes = false; }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "door") { doorClose.Play(); fadeController.FadeOut(); StartCoroutine(loadLevel()); } }
IEnumerator SpawnEnermies() { Time.timeScale = 5f; GameObject minion = null; for (int i = 0; i < enermyNum; i++) { switch (Random.Range(0, 3)) { case 0: minion = smallMinionPool.GetPooledObject(); break; case 1: minion = mediumMinionPool.GetPooledObject(); break; case 2: minion = largeMinionPool.GetPooledObject(); break; } minion.SetActive(true); minion.GetComponent <MinionManager>().ResetMinion(); yield return(new WaitForSeconds(.8f)); } if (GameSceneController.instance.currentLevel / 1 > 0) { GameSceneController.instance.hostageObject.SetActive(true); GameObject hostage1; int hostageNum = Mathf.FloorToInt(GameSceneController.instance.currentLevel / 1); for (int i = 0; i < hostageNum; i++) { hostage1 = hostageMinionPool.GetPooledObject(); hostage1.SetActive(true); hostage1.GetComponent <PickUp>().StartMoving(); yield return(new WaitForSeconds(.8f)); } } Time.timeScale = 1f; GameObject pickUp = pickUpPools[Random.Range(0, pickUpPools.Count)].GetPooledObject(); pickUp.SetActive(true); pickUp.GetComponent <PickUp>().StartMoving(); yield return(FadeController.FadeOut(GameSceneController.instance.ufo.GetComponent <SpriteRenderer>())); GameSceneController.instance.isPlayable = true; }
public void OnAdsCompleted() { StartCoroutine(FadeController.FadeOut(adsObject)); GameSceneController.instance.isPlayable = true; GameSceneController.instance.CrackPlanet(false); SoundManager.instance.PlayBGM(bgm); SceneManager.UnloadSceneAsync(5); }
// Start is called before the first frame update void Start() { sentences = new Queue <string>(); audioData = GetComponent <AudioSource>(); fadeController = GetComponent <FadeController>(); //We start the game with everything fade In; fadeController.FadeIn(0); scene = SceneManager.GetActiveScene(); if (scene.name == "Beginning_Scene") { narrator = GameObject.Find("NarratorDialogue").GetComponent <DialogueTrigger>(); player = GameObject.Find("PlayerDialogue").GetComponent <DialogueTrigger>(); narrator.TriggerDialogue(); } else if (scene.name == "Bus_Scene") { audioData.loop = true; audioData.PlayOneShot(roadSong, 1f); fadeController.FadeOut(2); player = GameObject.Find("PlayerDialogue").GetComponent <DialogueTrigger>(); player.TriggerDialogue(); } else if (scene.name == "House_Overview") { audioData.loop = true; audioData.PlayOneShot(roadSong, 1f); fadeController.FadeOut(2); player = GameObject.Find("PlayerDialogue").GetComponent <DialogueTrigger>(); player.TriggerDialogue(); } else if (scene.name == "End_Scene") { title.enabled = false; authors.enabled = false; audioData.loop = true; audioData.PlayOneShot(endSong, 1f); fadeController.FadeOut(2); player = GameObject.Find("PlayerDialogue").GetComponent <DialogueTrigger>(); player.TriggerDialogue(); } }
void Update() { if (Input.GetButtonUp("Submit") && !fadeController.isDone) { fadeController.FadeOut(); } if (fadeController.isDone) { SceneManager.LoadScene("house.scene"); } }
private void Update() { if (Input.anyKeyDown) { m_isIn = !m_isIn; if (m_isIn) { m_fadeController.FadeIn(m_fadeInTime, m_fadeInColor); } else { m_fadeController.FadeOut(m_fadeOutTime, m_fadeOutColor); } } }
void Start() { screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z)); audioData = GetComponent <AudioSource>(); fadeController = GetComponent <FadeController>(); //ensure game start with fade black fadeController.FadeIn(0); fadeController.FadeOut(2); StartCoroutine(ItchSpawner()); }
public void OnAdsCompleted() { StartCoroutine(FadeController.FadeOut(adsObject)); particle.SetActive(true); coinText.gameObject.SetActive(true); coinText.text = string.Format(LocalizedString.GetString("earned"), adsCoin); StartCoroutine(PlayCoinSound()); GameManager.instance.playerData.playerCoin += adsCoin; playerCoin.text = GameManager.instance.playerData.playerCoin.ToString(); }
private IEnumerator LoadLevel(int levelId, bool resetHp = false) { yield return(StartCoroutine(_fadeController.FadeIn())); SceneManager.LoadScene(levelId, LoadSceneMode.Single); foreach (GameObject g in _playerObjects) { g.SetActive(true); } if (resetHp) { _scriptablePlayer._lifes = 3; } yield return(StartCoroutine(_fadeController.FadeOut())); }
IEnumerator WaitFadeOut() { yield return(new WaitForSeconds(timeToFadeOut)); if (isLastScene == true) { mainCam.backgroundColor = bgColorCam; cena.SetActive(false); title.SetActive(true); StartCoroutine("WaitFadeIn"); } else { mainCam.backgroundColor = Color.black; spriteRenderer.sprite = cenas[idDialogo]; } _FadeController.FadeOut(); }
void Start() { Screen.sleepTimeout = SleepTimeout.NeverSleep; DontDestroyOnLoad(this); fadeScreen.gameObject.SetActive(true); fadeScreen.FadeOut(0.4f); inGameUI.alpha = 0; inGameUI.interactable = false; loadingGroup = loadingImage.GetComponent <CanvasGroup>(); swapGroup = swapImage.GetComponent <CanvasGroup>(); sceneButtons[0].onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowScene("ComplexScene")); }); sceneButtons[1].onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowScene("Hand2DSkeleton")); }); sceneButtons[2].onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowScene("Face2Dfacemark")); }); sceneButtons[3].onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowScene("Face3DSticker")); }); sceneButtons[4].onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowScene("Face3DMask")); }); backButton.onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ReturnScene()); }); swapButton.onClick.AddListener(() => { StopAllCoroutines(); StartCoroutine(ShowSwapCover()); }); }
private void Update() { /*フェードインが終わるまで入力を受け付けない*/ m_timer += Time.deltaTime; if (m_timer >= m_waitTimeToFadeIn) { m_canGetInput = true; } if (Input.GetButtonDown("Fire1") && m_canGetInput) { Debug.Log("TitleSceneManager:右クリック"); if (m_audio) { AudioSource.PlayClipAtPoint(m_audio, Camera.main.transform.position); } m_clickToStart.Play("IsClicked"); m_ac.FadeOut(m_timeToAudioFadeOut); m_fc.FadeOut(m_waitTimeToFadeOut); StartCoroutine(LoadScene()); } }
/// <summary> /// Moeve al jugador a la nueva area, activa el fadeOute y desactiva el area original /// </summary> /// <returns></returns> IEnumerator GoInDoor() { bool destinationIsWarm = currentRoomDetector.destinationIsWarm; changeColdStatus(destinationIsWarm); fadeController.FadeOut(); yield return(new WaitForSeconds(1f)); pm.transform.position = currentRoomDetector.destinationDoor.transform.position; Camera.main.gameObject.transform.position = new Vector3(currentRoomDetector.destinationDoor.transform.position.x, currentRoomDetector.destinationDoor.transform.position.y, -10f); currentRoomDetector.HideScenes(); yield return(new WaitForSeconds(1f)); fadeController.FadeIn(); pm.canMove = true; }