// Use this for initialization void Start() { scoreCounterScript = GameObject.Find("subScoreCounter").GetComponent <scoreCounter>(); simpleAdScript = GameObject.Find("simpleAd").GetComponent <simpleAd>(); if (!PlayerPrefs.HasKey("rewardedAdCounter")) { PlayerPrefs.SetInt("rewardedAdCounter", 0); } if (!PlayerPrefs.HasKey("rewardClaimed")) { PlayerPrefs.SetInt("rewardClaimed", 1); } }
void Start() { simpleAdScript = GameObject.Find("simpleAd").GetComponent <simpleAd>(); internetChecker = GameObject.Find("InternetChecker").GetComponent <InternetChecker>(); }
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(); } }