private void ChangeState(GameState newState) { if (state != newState) { state = newState; } switch (newState) { case GameState.Intro: StartCoroutine("PlayIntro"); break; case GameState.Play: StartCoroutine("LoseOxygen"); break; case GameState.Finish: StartCoroutine("PlayEnding"); break; case GameState.Over: StopCoroutine("LoseOxygen"); player.GetComponent <Rigidbody2D>().velocity = Vector2.zero; player.GetComponent <PlayerControls>().enabled = false; fade.FadeToBlack(); break; } }
public IEnumerator LoadLevel() { isLoading = true; AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex); operation.allowSceneActivation = false; screenFade.FadeToBlack(); sliderGameObject.SetActive(true); pressAnyButton.SetActive(true); tipsObject.SetActive(true); tips.text = tipsArray[Random.Range(0, tipsArray.Length - 1)]; while (!operation.isDone) { loadingProgress.value = operation.progress; if (operation.progress >= 0.9f) { if (Input.GetKeyDown(KeyCode.Space)) { operation.allowSceneActivation = true; isLoading = false; } } yield return(null); } }
void Update() { if (fadedIn && Input.anyKeyDown) { if (fadeToWhite) { sf.FadeToWhite(fadeOutDuration, FadeOutComplete); } else { sf.FadeToBlack(fadeOutDuration, FadeOutComplete); } } }
public void StartLight() { sf.FadeToBlack(1, StartLightFaded); }