public void powerTrip()
 {
     if (achPowerTrip == 3)
     {
         PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEw");
     }
 }
Example #2
0
    // Update is called once per frame
    public void upgradeSkill()
    {   //check if first time
        if (PlayerPrefs.GetInt("skillPoints") >= 1 && PlayerPrefs.GetInt(skillName + "Lvl") < 5)
        {
            //decrease skillpoint
            PlayerPrefs.SetInt("skillPoints", PlayerPrefs.GetInt("skillPoints") - 1);
            txtSP.text = "SP " + (Convert.ToInt32(txtSP) - 1).ToString();
            //upgrade
            PlayerPrefs.SetInt(skillName + "Lvl", PlayerPrefs.GetInt(skillName + "Lvl") + 1);
            loadSPSkills();



            if (!PlayerPrefs.HasKey("firstSkill"))
            {
                //add chosen skill to db
                PlayerPrefs.SetString("firstSkill", skillName);
            }
            else
            {
                upgradedView.SetActive(true);
                txtUpgrade.text     = "cooldown speed upgraded by " + (baseUpgradePercentage * PlayerPrefs.GetInt(skillName + "Lvl")).ToString() + "%";
                txtNextUpgrade.text = "Next upgrade -> " + (baseUpgradePercentage * (PlayerPrefs.GetInt(skillName + "Lvl") + 1)).ToString() + "%";
                if (PlayerPrefs.GetInt(skillName + "Lvl") >= 5)
                {
                    PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQDg");
                }
                PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQAQ");
            }
        }
        else
        {
            insufficient.Play();
        }
    }
 void achLastResort()
 {
     if (swipeScript.swipeCap < 1)
     {
         PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQCw");
     }
 }
Example #4
0
 // Update is called once per frame
 void Update()
 {
     //achievement
     if (PlayerPrefs.HasKey("endTimeboost") && PlayerPrefs.HasKey("endTimeattack") && PlayerPrefs.HasKey("endTimeshield"))
     {
         PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQFA");
         print("born ready!");
     }
 }
Example #5
0
    // Update is called once per frame
    void Update()
    {
        goldText.text = PlayerPrefs.GetInt("PlayerGold").ToString();

        //achievement
        if (PlayerPrefs.GetInt("PlayerGold") >= 1000)
        {
            PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEg");
        }
    }
Example #6
0
    void OnTriggerEnter(Collider obstacles)
    {
        if (obstacles.gameObject.CompareTag("Obstacles") && stopScore == false)
        {
            count = count + 1;

            //achievements
            if (count == 50)
            {
                PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQAw");
            }
            if (count == 100 && LavidaLoca)
            {
                PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQBQ");
            }
            if (count == 150)
            {
                PlayGamesManager.IncrementAchievement("CgkI1OXD-eYaEAIQDw", 5);
            }

            setCountText();

            lvlUp.checkReachedScore();

            if (freeCoinCounter >= 10)
            {
                freeCoinCounter = 0;

                /*  int tempCoins = PlayerPrefs.GetInt("tempGoldCoins");
                 * PlayerPrefs.SetInt("tempGoldCoins", tempCoins + 1);
                 *
                 * int Bc = int.Parse(bonusCoinsText.text);
                 * Bc += 1;
                 * bonusCoinsText.text = Bc.ToString();*/

                //increase difficulty
                if (rdmObjScript.spawnTimeObs > 0.3f)
                {
                    MoveSpeed += 0.2f;
                    rdmObjScript.spawnTimeObs -= 0.1f;
                    rdmObjScript.spawnTimeCol -= 0.1f;
                }

                /*   else
                 * {
                 *     rdmObjScript.spawnTimeObs = 0.3f;
                 *       MoveSpeed = 2.4f;
                 * }*/
            }
            else
            {
                freeCoinCounter += 1;
            }
        }
    }
    public void lvlUp()
    {
        if (expTotal >= lvl[PlayerPrefs.GetInt("playerLevel") - 1])
        {
            PlayerPrefs.SetInt("playerLevel", PlayerPrefs.GetInt("playerLevel") + 1);

            //increase swipe
            PlayerPrefs.SetInt("swipeCap", swipeBaseValue + (PlayerPrefs.GetInt("playerLevel") * swipeMultiplier));

            //notify code here
            PlayerPrefs.SetInt("skillPoints", PlayerPrefs.GetInt("skillPoints") + 1);

            //achievement
            if (PlayerPrefs.GetInt("playerLevel") >= 15)
            {
                PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEQ");
            }

            txtlvlup.text = "LVL " + PlayerPrefs.GetInt("playerLevel").ToString() + "!";
            lvlUpAnim.SetBool("leveledUp", true);

            PlayerPrefs.SetInt("justLeveledUp", 1);
        }

        print("expreq: " + (PlayerPrefs.GetInt("playerLevel") - 1).ToString());
        PlayerPrefs.SetFloat("expEarned", expTotal);
        txtLvl.text    = "lvl " + PlayerPrefs.GetInt("playerLevel").ToString();
        txtExpReq.text = lvl[PlayerPrefs.GetInt("playerLevel") - 1].ToString();
        int txtExpReqInt = Convert.ToInt32(txtExpReq.text.ToString());

        // txtExpCur.text = expTotal.ToString();

        //tempslider

        if (txtExpReqInt > lvl[0])
        {
            expSlider.maxValue = txtExpReqInt / 2;
            expSlider.value    = tempExpTotal - (txtExpReqInt / 2);
            lvlUpAnimationScript.invokeAnimateLevelUpPreceding();
        }
        else
        {
            expSlider.maxValue = lvl[PlayerPrefs.GetInt("playerLevel") - 1];
            expSlider.value    = tempExpTotal;
            lvlUpAnimationScript.invokeAnimateLevelUp();
        }
    }
    public void fireProjectile()
    {
        character  = GameObject.FindGameObjectWithTag("character");
        playerAnim = character.GetComponent <Animation>();

        if (PlayerPrefs.GetString("chosenChar") == "Shopper_girl")
        {
            playerAnim.Play("shopper_girl_attack");
            Invoke("replayFloat", 0.3f);
            projIndex = 0;
        }
        else if (PlayerPrefs.GetString("chosenChar") == "Fireman")
        {
            playerAnim.Play("gary_attack_anim");
            Invoke("replayFloat", 0.3f);
            projIndex = 1;
        }

        Instantiate(projectile[projIndex], spawnPointProjectile.transform.position, spawnPointProjectile.transform.rotation);
        btnAttack.interactable = false;
        cooldownAttackScript.decAttack();

        //achievement
        scoreCounter.LavidaLoca = false;
        achBlindsight++;

        if (achBlindsight == 3)
        {
            PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQDQ");
        }

        if (achPowerTripperAttack < 1)
        {
            achPowerTripperAttack++;
        }
        else if (achPowerTripperAttack == 1)
        {
            achPowerTripScript.achPowerTrip++;
            achPowerTripScript.powerTrip();
            achPowerTripperAttack++;
        }
    }
    public void startBoost()
    {
        swipeScript.targetPosition = boostLane.transform.position;
        Invoke("timeScaler", 1.6f);
        Invoke("decBoost", 4f);

        // disable buttons
        btnPause.GetComponent <Button>().interactable = false;
        btnBoost.GetComponent <Button>().enabled      = false;
        btnShield.GetComponent <Button>().enabled     = false;
        btnAttack.GetComponent <Button>().enabled     = false;

        //pauseCooldowns
        cDownAttack.isBoosting = true;
        cDownShield.isBoosting = true;
        pauseScript.isBoosting = true;

        //achievement
        scoreCounter.LavidaLoca = false;
        if (PlayerPrefs.GetInt("boost3timesAch") == 2)
        {
            PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQAg");
        }
        else
        {
            PlayerPrefs.SetInt("boost3timesAch", PlayerPrefs.GetInt("boost3timesAch") + 1);
        }

        if (achPowerTripperBoost < 1)
        {
            achPowerTripperBoost++;
        }
        else if (achPowerTripperBoost == 1)
        {
            achPowerTripScript.achPowerTrip++;
            achPowerTripScript.powerTrip();
            achPowerTripperBoost++;
        }
    }
 public void Unlock()
 {
     PlayGamesManager.UnlockAchievement(standardAchId);
 }
Example #11
0
    void OnTriggerEnter(Collider obj)
    {
        if (isDestroyer && (obj.tag == "Foreground" || obj.tag == "Obstacles"))
        {
            Destroy(obj.gameObject);
        }
        else if (obj.tag == "Obstacles")
        {
            if (gameObject.name == "playerShield")
            {
                try
                { Instantiate(explosion, transform.position, transform.rotation); }
                catch (Exception e) { }
                btnShieldObj = GameObject.Find("btnShield");
                /*if (SceneManager.GetActiveScene().name == "Game") */ shieldToggleScript = btnShieldObj.GetComponent <shieldToggle>();
                shieldToggleScript.deactivateShield();
                Destroy(obj.gameObject);
                GameObject  objSfxDestByShield = GameObject.Find("sfxDestroyedByShield");
                AudioSource asSfxDestByShield  = objSfxDestByShield.GetComponent <AudioSource>();
                asSfxDestByShield.Play();
                GameObject  player    = GameObject.FindGameObjectWithTag("Player");
                BoxCollider colPlayer = player.GetComponent <BoxCollider>();
                cdShieldScript.regenShield();

                //achievement
                if (obj.gameObject.name == "Tv(Clone)")
                {
                    if (achTv < 4)
                    {
                        achTv++;
                    }
                    else if (achTv >= 4)
                    {
                        PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEA");
                    }
                }
            }
            else if (gameObject.tag == "PowerAttack")
            {
                GameObject  objSfxDestByAttack = GameObject.Find("sfxDestroyedByAttack");
                AudioSource asSfxDestByAttack  = objSfxDestByAttack.GetComponent <AudioSource>();
                asSfxDestByAttack.Play();

                Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation);

                Invoke("destroyExp", 0.5f);
                Destroy(gameObject);
                Destroy(obj.gameObject);

                //achievement


                if (spawnProjectileScript.achBlindsight >= 1)
                {
                    spawnProjectileScript.achBlindsight--;
                }

                if (obj.gameObject.name == "Tv(Clone)")
                {
                    if (achTv < 4)
                    {
                        achTv++;
                    }
                    else if (achTv >= 4)
                    {
                        PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEA");
                    }
                }

                if (achDemolitionDerby < 2)
                {
                    achDemolitionDerby++;
                }
                else if (achDemolitionDerby >= 2)
                {
                    PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQCg");
                }
            }
        }
    }
    void OnTriggerEnter(Collider playerCollider)
    {
        if (playerCollider.gameObject.tag == "Obstacles")
        {
            // game over

            if (PlayerPrefs.GetInt("adsDisabled") == 0)
            {
                simpleAd = GameObject.Find("simpleAd").GetComponent <simpleAd>();
                simpleAd.gameOverAd();
            }
            if (PlayerPrefs.GetInt("rewardClaimed") == 1)
            {
                rewardedAdsScript.rewardedAd();
            }

            gameover.SetBool("isGameOver", true);
            swipeScript.isGameOver = true;
            pauseScript.isGameOver = true;

            if (character.name == "Ruth2")
            {
                character.GetComponent <Animation>().Play("shopper_dead_top");
            }
            else if (character.name == "Char")
            {
                character.GetComponent <Animation>().Play("gary_dead_animation");
            }


            scoring.enabled  = false;
            pDescend.enabled = true;
            scoring.stopScoring(true);
            btnPause.SetActive(false);
            cam.SendMessage("TurnBlurOn");
            ui.SetActive(false);

            //highscore
            hscoreScript = GameObject.Find("GameOver").GetComponent <highScore>();
            hscoreScript.CheckAndSet();

            //game over sfx
            GameObject  objSfxGameOver = GameObject.Find("sfxGameOver");
            AudioSource asSfxGameOver  = objSfxGameOver.GetComponent <AudioSource>();
            asSfxGameOver.Play();
            BoxCollider colPlayer = GetComponent <BoxCollider>();
            colPlayer.enabled = false;

            //addcoin from temp
            if (PlayerPrefs.HasKey("tempGoldCoins"))
            {
                tempGoldCoins = PlayerPrefs.GetInt("tempGoldCoins");
                goldCoins     = PlayerPrefs.GetInt("PlayerGold");
                PlayerPrefs.SetInt("PlayerGold", goldCoins + tempGoldCoins);
            }

            //expAnim

            /*    int txtExpReqInt = Convert.ToInt32(txtExpReq.text);
             *  if (txtExpReqInt > lvlUpScript.lvl[0])
             *  {
             *      expSlider.maxValue = txtExpReqInt / 2;
             *
             *  }*/

            //levelUp

            lvlUpScript.lvlUp();

            swipeScript.enabled = false;


            //achievement
            if (playerCollider.gameObject.name == "bed(Clone)")
            {
                if (!PlayerPrefs.HasKey("achBreakingBed"))
                {
                    PlayerPrefs.SetInt("achBreakingBed", 1);
                    PlayGamesManager.IncrementAchievement("CgkI1OXD-eYaEAIQBA", 5);
                }
                else if (PlayerPrefs.GetInt("achBreakingBed") < 5)
                {
                    PlayerPrefs.SetInt("achBreakingBed", PlayerPrefs.GetInt("achBreakingBed") + 1);
                    PlayGamesManager.IncrementAchievement("CgkI1OXD-eYaEAIQBA", 5);
                }
            }
        }

        else if (playerCollider.gameObject.tag == "CollectiblesCap")
        {
            // collectible capacity

            //achievement
            if (healthbarSlider.value == 1)
            {
                PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQCQ");
            }

            swipeScript.swipeCap  = Convert.ToInt32(healthbarSlider.maxValue);
            healthbarSlider.value = healthbarSlider.maxValue;
            Destroy(playerCollider.gameObject);
            print("cap collided");

            GameObject objSfxCap = GameObject.Find("sfxCollectSwipe");
            sfxScript = objSfxCap.GetComponent <SfxPlayer>();
            sfxScript.playSfx();
        }

        else if (playerCollider.gameObject.tag == "CollectiblesBoost")
        {
            // collectible boost

            btnBoost.interactable = true;
            rdmobj.stopBoostNow   = true;
            Destroy(playerCollider.gameObject);

            GameObject objSfxBoost = GameObject.Find("sfxCollectBoost");
            sfxScript = objSfxBoost.GetComponent <SfxPlayer>();
            sfxScript.playSfx();

            //achievement
            achLastResort();
        }

        else if (playerCollider.gameObject.tag == "CollectiblesShield")
        {
            // collectible shield

            btnShield.interactable = true;
            rdmobj.stopShieldNow   = true;
            Destroy(playerCollider.gameObject);

            GameObject objSfxShield = GameObject.Find("sfxCollectShield");
            sfxScript = objSfxShield.GetComponent <SfxPlayer>();
            sfxScript.playSfx();

            //achievement
            achLastResort();
        }

        else if (playerCollider.gameObject.tag == "CollectiblesAttack")
        {
            // collectible attack
            rdmobj.stopAttackNow   = true;
            btnAttack.interactable = true;
            Destroy(playerCollider.gameObject);

            GameObject objSfxAttack = GameObject.Find("sfxCollectAttack");
            sfxScript = objSfxAttack.GetComponent <SfxPlayer>();
            sfxScript.playSfx();

            //achievement
            achLastResort();
        }

        else if (playerCollider.gameObject.tag == "CollectiblesCoin")
        {
            Destroy(playerCollider.gameObject);

            GameObject objSfxCoin = GameObject.Find("sfxCollectCoin");
            sfxScript = objSfxCoin.GetComponent <SfxPlayer>();
            sfxScript.playSfx();

            //addCoin from colleced
            PlayerPrefs.SetInt("tempGoldCoins", PlayerPrefs.GetInt("tempGoldCoins") + 1);

            int Cc = int.Parse(colCoins.text);
            Cc           += 1;
            colCoins.text = Cc.ToString();


            uigoldScript.updateGoldCoin();
        }
    }
Example #13
0
    public virtual void ProcessScores(bool isOnStart)
    {
        if (isOnStart)
        {
            //load scores from preferences to variables
            highScore      = SecurePlayerPrefs.GetInt("HighScore");
            levelHighScore = SecurePlayerPrefs.GetInt("HighScoreLvl" + currentLevelID.ToString());
            coinScore      = SecurePlayerPrefs.GetInt("CoinScore");
            //scoreText.text = score.ToString();
            //highScoreText.text = highScore.ToString();
            //coinCountText.text = "x " + coinScore.ToString();
        }
        else
        {
            if (score.Equals(highScore))
            {
                SecurePlayerPrefs.SetInt("HighScore", highScore);

                if (PlayGamesPlatform.Instance.IsAuthenticated())
                {
                    //send highScore to Google Play Games Overall HighScores leaderboard
                    PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_overall_high_scores, Convert.ToInt64(highScore));
                }
            }

            if ((score.Equals(levelHighScore)) && (currentLevelID != 0))//Leaderboard
            {
                SecurePlayerPrefs.SetInt("HighScoreLvl" + currentLevelID.ToString(), highScore);

                if (PlayGamesPlatform.Instance.IsAuthenticated())
                {
                    //send highScore to Google Play Games Level leaderboard
                    switch (currentLevelID)
                    {
                    case 3:
                        PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_level_1_high_scores, Convert.ToInt64(levelHighScore));
                        break;

                    case 4:
                        PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_level_2_high_scores, Convert.ToInt64(levelHighScore));
                        break;

                    case 5:
                        PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_level_3_high_scores, Convert.ToInt64(levelHighScore));
                        break;

                    case 6:
                        PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_level_4_high_scores, Convert.ToInt64(levelHighScore));
                        break;
                    }
                }
            }

            if (PlayGamesPlatform.Instance.IsAuthenticated())
            {
                switch (coinScore)
                {
                case 5:
                    PlayGamesManager.UnlockAchievement(GPGSIds.achievement_first_5_coins);
                    break;

                case 25:
                    PlayGamesManager.UnlockAchievement(GPGSIds.achievement_first_25_coins);
                    break;

                case 50:
                    PlayGamesManager.UnlockAchievement(GPGSIds.achievement_first_50_coins);
                    break;

                case 100:
                    PlayGamesManager.UnlockAchievement(GPGSIds.achievement_first_100_coins);
                    break;

                case 250:
                    PlayGamesManager.UnlockAchievement(GPGSIds.achievement_first_250_coins);
                    break;

                default:
                    break;
                }
            }


            SecurePlayerPrefs.SetInt("CoinScore", coinScore);
        }
    }