void OnTriggerEnter2D(Collider2D hitinfo) { JumpSkull js = hitinfo.GetComponent <JumpSkull>(); EnemyGun eg = hitinfo.GetComponent <EnemyGun>(); Mines m = hitinfo.GetComponent <Mines>(); Boss b = hitinfo.GetComponent <Boss>(); Floor f = hitinfo.GetComponent <Floor>(); // Debug.Log(hitinfo.name); if (m != null) { m.TakeDamage(100); Destroy(gameObject); } if (eg != null) { eg.TakeDamage(50); Destroy(gameObject); } if (js != null) { js.TakeDamage(34); Destroy(gameObject); } if (b != null) { b.TakeDamage(20); Destroy(gameObject); } if (f != null) { Destroy(gameObject); } }