Exemplo n.º 1
0
    protected virtual void OnCollisionEnter2D(Collision2D col)
    {
        collisionBehaviour(col);

        IDamagable hp = col.gameObject.GetComponent <IDamagable> ();

        if (hp != null)
        {
            hp.ChangeHealth(-damage);
        }
    }
Exemplo n.º 2
0
    void CheckIfInBlackHoleVicinity(Collider2D other)
    {
        if (Vector3.Distance(transform.position, other.transform.position) <= killDistance)
        {
            IDamagable HP = other.GetComponent <IDamagable> ();

            if (HP != null)
            {
                HP.ChangeHealth(-10000);
            }
        }
    }