Esempio n. 1
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Food")
        {
            energy += creatureManager.foodEnergy;
            Destroy(collision.gameObject);
        }

        if (collision.gameObject.tag == "Creature")
        {
            Creature other = collision.gameObject.GetComponent <Creature>();
            if (size >= 2 * other.size)
            {
                energy += creatureManager.creatureEatEnergy;
                creatureManager.Eat(other);
            }
        }
    }