Beispiel #1
0
    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));
            }
        }
    }