void achLastResort() { if (swipeScript.swipeCap < 1) { PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQCw"); } }
// 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(); } }
private void EndGame() { Time.timeScale = 0f; // Stop the game after the game has ended... switch (difficulty) { case 1: if (score > PlayerPrefs.GetFloat("easyHighScore", 0)) { PlayerPrefs.SetFloat("easyHighScore", score); gameOverText.text = "HIGH SCORE:"; } break; case 2: if (score > PlayerPrefs.GetFloat("normalHighScore", 0)) { PlayerPrefs.SetFloat("normalHighScore", score); PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_global_high_score_normal, Convert.ToInt64(score)); gameOverText.text = "HIGH SCORE:"; } break; case 3: if (score > PlayerPrefs.GetFloat("hellHighScore", 0)) { PlayerPrefs.SetFloat("hellHighScore", score); PlayGamesManager.AddScoreToLeaderboard(GPGSIds.leaderboard_global_high_score_hell, Convert.ToInt64(score)); gameOverText.text = "HIGH SCORE:"; } break; } gameOverScoreText.text = (score > 999999999999) ? "999999999999" : Convert.ToInt64(score).ToString("000000000000.##"); gameOverUI.SetActive(true); }
public void powerTrip() { if (achPowerTrip == 3) { PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEw"); } }
// Use this for initialization void Awake() { EventManager.AddListener <AnalyticsGameEvent>(AnalyticsHandler); _Analytics = GetComponent <AnalyticsTracker>(); _AnalyticsTracker = GetComponent <AnalyticsEventTracker>(); _PlayGamesManager = GetComponent <PlayGamesManager>(); }
void Awake() { audio = GetComponent <AudioSource> (); octasUpdate = GetComponent <OctasUpdate> (); playManager = GetComponent <PlayGamesManager> (); audioManager = GetComponent <AudioManager> (); //saveMe = saveMeMenu.GetComponent<SaveMe> (); }
// 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!"); } }
// Update is called once per frame void Update() { goldText.text = PlayerPrefs.GetInt("PlayerGold").ToString(); //achievement if (PlayerPrefs.GetInt("PlayerGold") >= 1000) { PlayGamesManager.UnlockAchievement("CgkI1OXD-eYaEAIQEg"); } }
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 ShowLeaderboard() { if (PlayGamesPlatform.Instance.IsAuthenticated()) { PlayGamesManager.ShowLeaderboardsUI(); } else { SignInOutAction(); } }
// Use this for initialization void Awake() { if (_instance == null && _instance != this) { _instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Awake() { if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } }
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++; } }
private void LoadSaveData(string data) { Debug.Log("Loaded save data: " + data); JSONNode node = JSONNode.Parse(data); int level = node["level"].AsInt; int oldLevel = SaveGame.GetLastLevelUnlocked(); for (int i = SaveGame.GetLastLevelUnlocked(); i < level; i++) { SaveGame.completedLevel(i, false); } for (int i = 1; i <= 50; i++) { if (node["stars"]["" + i].AsBool) { SaveGame.completedLevel(i, true); } } if (oldLevel != SaveGame.GetLastLevelUnlocked()) { if (SceneManager.GetActiveScene().name == "NewMap") { SceneManager.LoadScene("NewMap"); } } PlayGamesManager.SyncAchievements(); /* * var N = JSON.Parse(the_JSON_string); * var versionString = N["version"].Value; // versionString will be a string containing "1.0" * var versionNumber = N["version"].AsFloat; // versionNumber will be a float containing 1.0 * var name = N["data"]["sampleArray"][2]["name"];// name will be a string containing "sub object" */ }
// Show Google Play Games Leaderboard in the UI public void ShowLeaderboards() { PlayGamesManager.ShowLeaderboardUI(); }
// Show Google Play Games Achivements in the UI public void ShowAchivements() { PlayGamesManager.ShowAchivementUI(); }
// Unlock an Achivement public void Unlock(string achivementName) { //Pass the Achivement you want to Unlock from the GPSIds Script PlayGamesManager.UnlockAchivement(achivementName); }
// Increment the the steps of the achivement to Unlock public void Increment(string achivementName, int amount) { PlayGamesManager.IncrementAchivement(achivementName, amount); }
void Awake() { Instance = this; }
// Use this for initialization void Start() { _playGamesManager = GameObject.Find("PlayGamesManager").GetComponent <PlayGamesManager>(); SetupMultiplayerGame(); }
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(); } }
public void Login() { PlayGamesManager.ConnectToGoogleServices(); }
// Use this for initialization void Start() { Advertising.Init(); PlayGamesManager.Init(); SceneManager.LoadScene("NewMap"); }
public void LoadAc() { PlayGamesManager.LoadAchievements(); }
public void Unlock() { PlayGamesManager.UnlockAchievement(standardAchId); }
public void RestartGame() { PlayGamesManager.AddScoreToLeaderboard(GaryGravityResources.leaderboard_swifest_leaderboard, Counter); Counter = 0; }
public void Increment() { PlayGamesManager.IncrementAchievement(incrementalAchId, 5); }
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"); } } } }