Ejemplo n.º 1
0
    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;
        }
    }
Ejemplo n.º 2
0
    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);
        }
    }
Ejemplo n.º 3
0
 void Update()
 {
     if (fadedIn && Input.anyKeyDown)
     {
         if (fadeToWhite)
         {
             sf.FadeToWhite(fadeOutDuration, FadeOutComplete);
         }
         else
         {
             sf.FadeToBlack(fadeOutDuration, FadeOutComplete);
         }
     }
 }
Ejemplo n.º 4
0
 public void StartLight()
 {
     sf.FadeToBlack(1, StartLightFaded);
 }