Example #1
0
 public void Exit()
 {
     exitOn = true;
     if (NoADS.ads == 0)
     {
         AppnextVideoAndroid.showInterstitial("feb28299-00d1-4c17-a5f5-79f33cfda3bb", AppnextVideoAndroid.INTERSTITIAL);
     }
 }
Example #2
0
    public void EarnCoin()
    {
        AppnextVideoAndroid.cacheInterstitial("393dd20c-afc1-4c71-9620-8b900d89befc", AppnextVideoAndroid.REWARDED);
        coins += 10;
        PlayerPrefs.SetInt("coins", coins);
        AppnextVideoAndroid.showInterstitial("393dd20c-afc1-4c71-9620-8b900d89befc", AppnextVideoAndroid.REWARDED);


        game2 = false;
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        coinsTex.text = "Coins: " + coins;



        if (NoADS.ads == 0)
        {
            if (startAd == 0)
            {
                if (ad)
                {
                    timer3 += Time.deltaTime;
                    if (timer3 >= 1)
                    {
                        if (rand)
                        {
                            showVid = Random.Range(0, 3);
                            rand    = false;
                        }


                        if (showVid == 1)
                        {
                            if (Appodeal.isLoaded(Appodeal.VIDEO))
                            {
                                timer3  = 0;
                                startAd = 5;
                                PlayerPrefs.SetInt("startAD", startAd);

                                Appodeal.show(Appodeal.VIDEO);
                                ad = false;
                            }
                        }
                        else
                        {
                            timer3  = 0;
                            ad      = false;
                            startAd = 5;
                            PlayerPrefs.SetInt("startAD", startAd);
                            AppnextVideoAndroid.showInterstitial("feb28299-00d1-4c17-a5f5-79f33cfda3bb", AppnextVideoAndroid.INTERSTITIAL);
                        }
                    }
                }
            }
        }


        if (musicOn == 1)
        {
            if (Music2)
            {
                Destroy(Music2);
            }
        }
        else
        {
            if (!Music2)
            {
                Instantiate(Music, Music.transform.position, Music.transform.rotation);
                Music2 = GameObject.FindGameObjectWithTag("music");
                DontDestroyOnLoad(Music2);
            }
        }


        if (sfxON == 0)
        {
            if (coinSound)
            {
                coinSound = false;
                Instantiate(CoinSFX, CoinSFX.transform.position, CoinSFX.transform.rotation);
                CoinSFX2 = GameObject.FindGameObjectWithTag("SFX");
                SFX      = CoinSFX2.GetComponent <AudioSource> ();
            }
        }

        if (SFX)
        {
            if (!SFX.isPlaying)
            {
                Destroy(CoinSFX2);
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            timer = 0;
            if (!earnMoneyOn)
            {
                game2 = true;
            }
            buttonDown = true;
        }



        if (buttonDown)
        {
            if (!game)
            {
                timer += Time.deltaTime;
                if (timer >= 0.5f)
                {
                    buttonDown = false;
                    timer      = 0;

                    if (exitOn)
                    {
                        Application.Quit();
                    }

                    if (game2)
                    {
                        RateBut.SetActive(false);
                        PrizesBut.SetActive(false);
                        earnCoinBut.SetActive(false);
                        distanceText.SetActive(true);
                        coinsText.SetActive(true);
                        RecordText.SetActive(false);
                        coinsText2.SetActive(false);
                        Appodeal.hide(Appodeal.BANNER_TOP);
                        ExitButton.SetActive(false);
                        sfxToggle.SetActive(false);
                        musicToggle.SetActive(false);
                        TapToPlay.SetActive(false);
                        shop.SetActive(false);
                        leaders.SetActive(false);
                        achievements.SetActive(false);
                        NoAds.SetActive(false);
                        Instantiate(balls [iBall], new Vector3(0, 1, 0), balls [iBall].transform.rotation);
                        Instantiate(tiltControll, tiltControll.transform.position, tiltControll.transform.rotation);
                        balls [iBall] = GameObject.FindGameObjectWithTag("Ball");
                        game          = true;
                    }
                }
            }
        }



        if (game)
        {
            cameraPos = transform.position;



            if (exitOn)
            {
                timer += Time.deltaTime;
                if (timer >= 0.5f)
                {
                    Application.Quit();
                }
            }


            if (isDestroy)
            {
                isDestroy = false;

                targetZ += 20;
                newPosition.Set(0, 0, targetZ);

                i = Random.Range(0, 47);
                Instantiate(parts [i], newPosition, parts [i].transform.rotation);

                i2 = Random.Range(0, 3);
                if (i2 == 1)
                {
                    i = Random.Range(0, 47);
                    Instantiate(parts [i], newPosition, parts [i].transform.rotation);
                }
            }

            if (balls [iBall])
            {
                if (balls [iBall].transform.position.y <= -20)
                {
                    if (NoADS.ads == 0)
                    {
                        Appodeal.show(Appodeal.BANNER_TOP);
                    }
                    ad = true;
                    if (done)
                    {
                        done = false;
                        if (startAd > 0)
                        {
                            startAd -= 1;
                        }
                    }
                    PlayerPrefs.SetInt("startAD", startAd);
                    gameOverCanv.SetActive(true);
                    mainCanv.SetActive(false);
                    PlayerPrefs.SetInt("coins", coins);
                }
            }



            newZ = transform.position.z;


            cameraPosition.Set(0, 35, newZ + speed);
            skyPosition.Set(0, -10, newZ + speed);
            sky.position       = skyPosition;
            transform.position = cameraPosition;
            if (speed < 0.037f)
            {
                speed += 0.000007f;
            }
        }



        if (tapPlayOn)
        {
            if (!game)
            {
                timer2 += Time.deltaTime;
                if (timer2 >= 1)
                {
                    timer2 = 0;

                    if (TapToPlay.activeSelf)
                    {
                        TapToPlay.SetActive(false);
                    }
                    else
                    {
                        TapToPlay.SetActive(true);
                    }
                }
            }
        }
    }