Ejemplo n.º 1
0
    private void CheckForAd()
    {
        bool hasRemoveAds = false;

        if (SaveManager.Instance != null)
        {
            hasRemoveAds = SaveManager.Instance.GetHasRemoveAdsStatus();
        }

        int numPlays = StaticInfo.GetNumberOfPlays();

        if (numPlays > 0 && numPlays % 3 == 0 && !hasRemoveAds && !watchedRewardedAd)
        {
            if (UnityAds.CheckForAd())
            {
                SoundManager.Instance.FadeOutBackgroundMusic(1f);
                UnityAds.ShowAd(AdCompleted);
            }
            else
            {
                // Debug.Log("Add didn't show");
                LoadScene(currentLoadString);
            }
        }
        else
        {
            LoadScene(currentLoadString);
        }
    }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (dead)
        {
            return;
        }

        GameObject go = other.gameObject;

        switch (go.tag)
        {
        case "Exit":
            UnityAds.ShowAd();
            sound.play = Sound.VICTORY;
            victory    = true;
            break;

        case "Enemy":
            if (shielded)
            {
                shielded = false;
                ds.shields--;
                ds.Save();
                enemyCol = go.GetComponents <Collider2D> ();

                for (int i = 0; i < enemyCol.Length; i++)
                {
                    enemyCol[i].enabled = false;
                }

                trail.SetActive(false);
                Debug.Log("perdi o shield");
            }
            else
            {
                Debug.Log("morri");
                sound.play = Sound.DEAD;
                dead       = true;
            }
            break;

        case "Water":
            sound.play   = Sound.DEAD;
            dead         = true;
            diedInLiquid = true;
            break;
        }
    }