Exemple #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("ScoreOrb"))
        {
            EatSound.Play();
            anim.SetBool("eat", true);
            collision.gameObject.SendMessage("DeathAnimation");
            Destroy(collision.gameObject);
            ge.SpawnOrbs();
            ge.PlusScore(25);
        }
        if (collision.CompareTag("DeathOrb"))
        {
            dead = true;
            StartCoroutine(Death(collision));
        }

        if (collision.CompareTag("BulletOrb"))
        {
            dead = true;
            StartCoroutine(Death(collision));
        }

        if (collision.CompareTag("BonusOrb"))
        {
            CoinSound.Play();
            anim.SetBool("eat", true);
            DestroyObject(collision.gameObject);
            ge.PlusScore(50);
            ge.AddCoin();
        }
    }