Ejemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.CompareTag("Metal"))
        {
            SFX.EatMetal();
            Destroy(other.gameObject);
            ableToEat = false;
            Debug.Log("cannot eat");
            StartCoroutine(Digest());
        }

        if ((other.gameObject.CompareTag("NonEdible")))
        {
            SFX.Ouch();
            energy -= energyReduceByNonEdible;
            Debug.Log(energy);
        }

        if ((other.gameObject.CompareTag("Organic")) && (ableToEat == true))
        {
            SFX.EatAstro();
            energy += energyIncreaseByOrganic;
            Debug.Log(energy);
            Destroy(other.gameObject);
            eatAnim();
        }
    }