Exemple #1
0
    /// <summary>
    /// Reloads our current level, effectively "restarting" the
    /// game
    /// </summary>
    public void Restart()
    {
        //TODO increment the achievements
        if (player)
        {
            GooglePlayGame.CheckAdchievements((int)player.Score);
        }

        if (UnityAdController.restartWithoutAds >= UnityAdController.restartAdsThreshold &&
            UnityAdController.showAds)
        {
            UnityAdController.restartWithoutAds = 0;
            UnityAdController.ShowAd();

            if (pauseMenu.activeInHierarchy)
            {
                pauseMenu.SetActive(false);
            }
        }
        else
        {
            UnityAdController.restartWithoutAds++;
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            UnityAdController.nextRewardAvalible = true;
        }
    }
Exemple #2
0
    /// <summary>
    /// Will load a new scene upon being called
    /// </summary>
    /// <param name="levelName">The name of the level we want
    /// to go to</param>
    public void LoadLevel(string levelName)
    {
        SceneManager.LoadScene(levelName);

        if (UnityAdController.showAds)
        {
            // Show an ad
            UnityAdController.ShowAd();
        }
    }
Exemple #3
0
    /// <summary>
    /// method to load the scene.
    /// </summary>
    /// <param name="nameScene">Name of scene to load</param>
    public void loadScene(string nameScene)
    {
        if (UnityAdController.showAds)
        {
            // show an ad
            UnityAdController.ShowAd();
        }

        SceneManager.LoadScene(nameScene);
    }
Exemple #4
0
    /// <summary>
    /// Load scence
    /// </summary>
    /// <param name="nameScene">Name of the scene to be loaded</param>
    public void loadScene(string nameScene)
    {
        ObstacleBehavior.velocidadeRolamento = 2.0f;

        if (UnityAdController.showAds)
        {
            UnityAdController.ShowAd();
        }

        SceneManager.LoadScene(nameScene);
    }
    /// <summary>
    /// Will load a new scene upon being called
    /// </summary>
    /// <param name="levelName">The name of the level we want
    /// to go to</param>
    public virtual void LoadLevel(string levelName)
    {
        SceneManager.LoadScene(levelName);

        #if UNITY_ADS
        if (UnityAdController.showAds)
        {
            // Show an ad
            UnityAdController.ShowAd();
        }
        #endif
    }
Exemple #6
0
    public void CarregaScene(string nomeScene)
    {
        //Carrega a Scene Tutorial e seta a quantidade de gemas do jogador para 0
        SceneManager.LoadScene(nomeScene);
        ControllerJogo.gems = 0;

#if UNITY_ADS
        // Mostra um Ad quando o jogador começar o Jogo
        if (UnityAdController.showAds)
        {
            UnityAdController.ShowAd();
        }
    #endif
    }
Exemple #7
0
    // Start is called before the first frame update
    void Start()
    {
        //Inicializar o Unity Ads
        UnityAdController.InitializeAd();

        //Seta a posição do jogador nas coordenadas do GameObject com tag "Spawn"
        gameObject.transform.position = GameObject.FindGameObjectWithTag("Spawn").transform.position;

        //Obter acesso ao componente Rigidbody associado a esse GO (Game Object)
        rb = GetComponent <Rigidbody2D>();

        //Obter acesso ao componente BoxCollider2D associado a esse GO (Game Object)
        boxC = GetComponent <BoxCollider2D>();

        //Obter acesso ao componente Animator associado a esse GO (Game Object)
        anim = GetComponent <Animator>();
    }
    /// <summary>
    /// Metodo para pausar o jogo
    /// </summary>
    /// <param name="isPaused"></param>
    public void Pause(bool isPaused)
    {
        paused = isPaused;

        Time.timeScale = (paused) ? 0 : 1;

        menuPausePanel.SetActive(paused);

        if (isPaused == false)
        {
            if (MusicaController.musica != null)
            {
                MusicaController.musica.Play();
            }
        }
        else
        {
            UnityAdController.PlayVideoAd();
        }
    }
Exemple #9
0
 void Start()
 {
     //Inicializador para o Unity Ads
     UnityAdController.InitializeAd();
 }