// Update is called once per frame private void OnTriggerEnter2D(Collider2D collision) { PlayerBlackSoul player = collision.GetComponent <PlayerBlackSoul>(); if (player != null) { player.TakeDamage(damage); } Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D hitInfo) { PlayerBlackSoul enemy = hitInfo.GetComponent <PlayerBlackSoul>(); if (enemy != null) { enemy.TakeDamage(Damage); } Instantiate(explosion, transform.position, transform.rotation); Destroy(gameObject); }