private void OnTriggerEnter(Collider other) { if (other.CompareTag("Coin")) { PlayServices.IncrementeAchivement(CatRunServices.achievement_colete_100_peixes, 1); coins++; ulManager.UpdateCoins(coins); other.transform.parent.gameObject.SetActive(false); if (coins > PlayServices.GetPlayerScore(CatRunServices.leaderboard_ranking_coins)) { PlayServices.PostScore((long)score, CatRunServices.leaderboard_ranking_coins); } } if (other.CompareTag("DoubleScore")) { StartCoroutine(DoublePoints(doubleScoreTime)); other.gameObject.SetActive(false); } if (invencible) { return; } if (other.CompareTag("Obstacle")) { canMove = false; currentLife--; ulManager.UpdateLives(currentLife); an.SetTrigger("Hit"); speed = 0; if (currentLife <= 0) { speed = 0; an.SetBool("Dead", true); ulManager.gameOverPanel.SetActive(true); if (score > PlayServices.GetPlayerScore(CatRunServices.leaderboard_ranking)) { PlayServices.PostScore((long)score, CatRunServices.leaderboard_ranking); } Invoke("CallMenu", 2f); } else { Invoke("CanMove", 0.75f); StartCoroutine(Blinking(invencibleTime)); } } }
void DeadCheck() { if (isDead == false && Camera.main.transform.position.y - transform.position.y > 6) { StopPlayer(); DeadEffect(); isDead = true; GameObject.Find("GameManager").GetComponent <GameManager>().GameOver(); if (score > PlayServices.GetPlayerScore(GPGSIds.leaderboard_ranking)) { PlayServices.PostScore((long)score, GPGSIds.leaderboard_ranking); } AdMob.instance.deaths++; if (AdMob.instance.deaths >= 3) { AdMob.instance.deaths = 0; AdMob.instance.ShowPopUp(); } } }