private void OnTriggerEnter2D(Collider2D other) { if (canHitTrig(other.gameObject)) { ExploreCat cat = Hit(other.gameObject); if (cat != null) { cat.hitByObj(damage, this); } onHit(); } }
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(); } }
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()); }