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 Increment() { PlayGamesManager.IncrementAchievement(incrementalAchId, 5); }
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(); } }