private void OnTriggerEnter2D(Collider2D other) { if (canBreakTrough) { return; } if (other.tag != "Bullet" && other.tag != "searcher") { var isMeEnemy = owner.getCharacterSystem().isEnemy(); var otherCharacterSystem = other.gameObject.GetComponent <CharacterSystem>(); var isOtherEnemy = otherCharacterSystem && otherCharacterSystem.isEnemy(); if (isOtherEnemy && isMeEnemy) { return; } if (isOtherEnemy && owner.getCharacterSystem().CompareTag("Player")) { owner.getWeaponSystem().playShootAudio(); } AbilitySystem abilitySystem = other.gameObject.GetComponent <AbilitySystem>(); if (abilitySystem && weaponAbility) { var abilityInstance = Instantiate(weaponAbility); abilitySystem.addExternalEffect(abilityInstance); } Destroy(gameObject); } }