Exemple #1
0
 void OnCollisionStay2D(Collision2D other)
 {
     if (other.gameObject.tag == "Blob")
     {
         BlobData bd = other.gameObject.GetComponent <BlobData>();
         bd.TakeDamage();
     }
 }
Exemple #2
0
    void OnCollisionStay2D(Collision2D other)
    {
        if (other.gameObject.tag == "Blob")
        {
            BlobData bd = other.gameObject.GetComponent <BlobData>();

            if (!eating && bd.team != my_bd.team)
            {
                eating = other.gameObject;
            }

            if (eating == other.gameObject)
            {
                bd.TakeDamage();
            }
        }
    }