Example #1
0
	IEnumerator FadeInAnimation (string levelName) {
		fadeCanvas.SetActive (true);
		fadeAnim.Play ("FadeIn");
		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (0.7f));
		SceneManager.LoadScene (levelName);
		FadeOut ();
	}
Example #2
0
    IEnumerator PlayerDiedRestartLevel()
    {
        //Debug.Log("GameplayController.PlayerDiedRestartLevel() called");
        levelInProgress = false;

        coins           = 0;
        smallBallsCount = 0;

        Time.timeScale = 0;

        if (LoadingScript.instance != null)
        {
            LoadingScript.instance.FadeOut();
        }


        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1.25f)));

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);

        if (LoadingScript.instance != null)
        {
            LoadingScript.instance.PlayFadeInAnimation();
        }
    }
Example #3
0
    private IEnumerator LevelCompleted()
    {
        countdownLevel        = false;
        pauseBtn.interactable = false;
        int currentLevel = GameController.instance.currentLevel;

        currentLevel++;
        if (currentLevel < GameController.instance.levels.Length)
        {
            GameController.instance.levels[currentLevel] = true;
        }
        Object.Instantiate(endOfLevelRewards[GameController.instance.currentLevel], new Vector3(0f, Camera.main.orthographicSize, 0f), Quaternion.identity);
        if (GameController.instance.doubleCoins)
        {
            coins *= 2;
        }
        GameController.instance.coins = coins;
        GameController.instance.Save();
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(4f)));

        levelInProgress = true;
        Player.instance.StopMoving();
        Time.timeScale = 0f;
        levelFinishedPanel.SetActive(value: true);
        showScoreAtTheEndOfLevelText.text = string.Concat(playerScore);
    }
	IEnumerator GivePlayerLivesAfterWatchingVideo () {
		watchVideoText.text = "Thank you for watching!";
		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (2f));

		coins = 0;
		playerLives = 2;
		smallBallsCount = 0;

		GameController.instance.currentLives = playerLives;
		GameController.instance.currentScore = playerScore;

		Time.timeScale = 0;

		if (LoadingScreen.instance != null) {
			LoadingScreen.instance.FadeOut ();
		}

		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (1.25f));

		// Application.loadedLevelName
		SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

		if (LoadingScreen.instance != null) {
			LoadingScreen.instance.PlayFadeInAnimation ();
		}
	}
Example #5
0
    IEnumerator GiveLivesForVideo()
    {
        watchVideoText.text = "Thank you for watching.";

        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(2f)));

        coins           = 0;
        lives           = 2;
        smallBallsCount = 0;

        GameController.instance.currentLives = lives;
        GameController.instance.currentScore = score;

        Time.timeScale = 0;

        if (LoadingScreen.instance != null)
        {
            LoadingScreen.instance.FadeOut();
        }

        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1.25f)));

        SceneController.LoadLevel(SceneController.GetCurrentScene().name);

        if (LoadingScreen.instance != null)
        {
            LoadingScreen.instance.PlayLoadingScreen();
        }
    }
Example #6
0
    IEnumerator IELevelCompleted()
    {
        countDownLevel        = false;
        pauseBtn.interactable = false;

        int unlockedLevel = GameController.instance.currentLevel;

        unlockedLevel++;

        if (!(unlockedLevel >= GameController.instance.levels.Length))
        {
            GameController.instance.levels [unlockedLevel] = true;
            GameController.instance.Save();
        }

//		Instantiate (endOfLevelRewards [GameController.instance.currentLevel],
//			new Vector3 (0, Camera.main.orthographicSize, 0), Quaternion.identity);

        if (GameController.instance.doubleCoins)
        {
            coins *= 2;
        }

        GameController.instance.coins += coins;
        GameController.instance.Save();

        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(2.5f)));

        levelInProgress = false;
        Player.instance.StopMoving();
        Time.timeScale = 0f;

        levelFinishedPanel.SetActive(true);
        showScoreAtEndOfLevelText.text = "" + playerScore;
    }
Example #7
0
    private IEnumerator SetPlayerInvincible()
    {
        isInvincible = true;
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(3)));

        isInvincible = false;
    }
Example #8
0
    IEnumerator FadeOutAnimation()
    {
        fadeAnim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        fadeCanvas.SetActive(false);
    }
    IEnumerator GivePlayerLivesRewardAfterWatchingVideo()
    {
        watchVideoText.text = "Thank Yout For Watching The Video. You Earn 2 Extra Lives";
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(2f)));

        coins          = 0;
        playerLives    = 2;
        smallBallCount = 0;

        GameController.instance.currentLives = playerLives;

        GameController.instance.currentScore = playerScore;
        Time.timeScale = 0;

        if (LoadingScreen.instance != null)
        {
            LoadingScreen.instance.FadeOut();
        }

        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1.25f)));

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);


        if (LoadingScreen.instance != null)
        {
            LoadingScreen.instance.PlayFadeInAnimation();
        }
    }
Example #10
0
    IEnumerator GivePlayerLivesRewardAfterWatchingVideo()
    {
        //Debug.Log("GameplayController.GivePlayerLivesRewardAfterWatchingVideo() called");
        watchVideoText.text = "Thank You For Viewing!~";
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(2f)));

        coins           = 0;
        playerLives     = 2;
        smallBallsCount = 0;
        GameController.instance.currentLevel = playerLives;
        GameController.instance.currentScore = playerScore;
        Time.timeScale = 0;

        if (LoadingScript.instance != null)
        {
            LoadingScript.instance.FadeOut();
        }
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1.25f)));

        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        if (LoadingScript.instance != null)
        {
            LoadingScript.instance.PlayFadeInAnimation();
        }
    }
Example #11
0
    IEnumerator AnimateNotificationPanel(string message)
    {
        notificationAnim.Play("SlideIn");
        notificationText.text = message;
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(2f)));

        notificationAnim.Play("SlideOut");
    }
Example #12
0
    IEnumerator _FadeOut(String level)
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        Application.LoadLevel(level);
    }
Example #13
0
    IEnumerator FadeInAnimation(string leveName)
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.7f)));

        FadeOut();
    }
    IEnumerator IEQuitGame()
    {
        GameController.instance.Save();

        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.5f)));

        Application.Quit();
    }
    IEnumerator CallAds()
    {
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(3f)));

        LoadInterstitial();
        LoadVideo();
        AppLovin.ShowAd(AppLovin.AD_POSITION_TOP, AppLovin.AD_POSITION_CENTER);
    }
Example #16
0
    private IEnumerator FadeIn()
    {
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.4f)));

        if (GameplayController.instance != null)
        {
            GameplayController.instance.setHasLevelBegan(hasLevelBegan: true);
        }
    }
	IEnumerator ShowLoadingScreen () {
		Show ();
		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (1f));
		Hide ();

		if (GameplayController.instance != null) {
			GameplayController.instance.setHasLevelStarted (true);
		}
	}
Example #18
0
    IEnumerator FadeOutAnimation()
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.1f)));

        fadeCanvas.SetActive(false);
        Application.LoadLevel("GamePlay");
    }
Example #19
0
    IEnumerator FadeInAnimate(string level)
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.7f)));

        SceneManager.LoadScene(level);
//        Application.LoadLevel(level);
        FadeOut();
    }
	IEnumerator PromptUserToWatchAVideo () {
		levelInProgress = false;
		countDownLevel = false;
		pauseBtn.interactable = false;

		Time.timeScale = 0;

		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (0.7f));
		playerDiedPanel.SetActive (true);
	}
	IEnumerator FadeIn () {
		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (0.4f));

		if (GameplayController.instance != null) {
			GameplayController.instance.setHasLevelStarted (true);
		}

		yield return StartCoroutine (MyCoroutine.WaitForRealSeconds (0.9f));
		fadePanel.SetActive (false);
	}
Example #22
0
    IEnumerator FadeInAnimation(string LevelName)
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeIn Animation");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.7f))); // return another coroutine from another coroutine in another class

        SceneManager.LoadScene(LevelName);                                 // load scene process
        //FadeOut(); // fadeout after fade in
        StartCoroutine(FadeOutAnimation());
    }
Example #23
0
    private IEnumerator ShowLoadingScreen()
    {
        Show();
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.5f)));

        Hide();
        if (GameplayController.instance != null)
        {
            GameplayController.instance.setHasLevelBegan(hasLevelBegan: true);
        }
    }
Example #24
0
    private IEnumerator PromptTheUserToWatchAVideo()
    {
        levelInProgress       = false;
        countdownLevel        = false;
        pauseBtn.interactable = false;
        Time.timeScale        = 0f;
        Spawner.Instance.StopSpawning();
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.7f)));

        playerDiedPanel.SetActive(value: true);
    }
    IEnumerator FadeInOut(string level)
    {
        panel.SetActive(true);
        animator.Play("FadeOut");
        yield return(MyCoroutine.WaitForRealSeconds(1f));

        SceneManager.LoadScene(level);
        animator.Play("FadeIn");
        yield return(MyCoroutine.WaitForRealSeconds(.7f));

        panel.SetActive(false);
    }
Example #26
0
    IEnumerator FadeInOut(string level)
    {
        panel.SetActive(true);
        anim.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        Application.LoadLevel(level);
        anim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.7f)));

        panel.SetActive(false);
    }
Example #27
0
    IEnumerator FadeInOut(string level)
    {
        fadePanel.SetActive(true);                                         //Turn on panel
        fadeAnim.Play("FadeIn");                                           //Fade it in
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.2f))); //wait a moment

        SceneManager.LoadScene(level);                                     //Change scene
        fadeAnim.Play("FadeOut");                                          //Fade out to scene
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.7f))); //Wait some more

        fadePanel.SetActive(false);                                        //Turn off panel
    }
Example #28
0
    IEnumerator FadeInOut(string level)
    {
        fadePanel.SetActive(true);
        fadeAnim.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        SceneManager.LoadScene(level);
        fadeAnim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        fadePanel.SetActive(false);
    }
Example #29
0
    IEnumerator FadeInAnimation(string sceneName)
    {
        fadeCanvas.SetActive(true);
        fadeAnim.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.3f)));

        SceneManager.LoadScene(sceneName);
        fadeAnim.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(0.3f)));

        fadeCanvas.SetActive(false);
    }
Example #30
0
    IEnumerator FadeInOut(string scene)
    {
        canvas.SetActive(true);
        animator.Play("FadeOut");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(1f)));

        SceneManager.LoadScene(scene);
        animator.Play("FadeIn");
        yield return(StartCoroutine(MyCoroutine.WaitForRealSeconds(.7f)));

        canvas.SetActive(false);
    }