Example #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (canHitTrig(other.gameObject))
     {
         ExploreCat cat = Hit(other.gameObject);
         if (cat != null)
         {
             cat.hitByObj(damage, this);
         }
         onHit();
     }
 }
Example #2
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (canHitCol(other.collider))
        {
            ExploreCat cat = Hit(other.gameObject);
            if (cat != null)
            {
                particleEffect();
                cat.hitByObj(damage, this);
            }
            GetComponent <CircleCollider2D>().isTrigger = true;

            onHit();
        }
    }
Example #3
0
    public void Target(ExploreCat EC)
    {
        EC.hitByObj(damage, this);

        if (damage > 0)
        {
            timeAlive = 0;
            particleEffect();
        }
        else
        {
            timeAlive         = timeToLive;
            getSprite().color = Color.clear;
        }

        onHit();
        StartCoroutine(Fade());
    }