private void OnTriggerEnter(Collider other) { //prevent attack to self or teammates if (other.CompareTag("Enemy") && bulletStat.attacker.CompareTag("Player")) { CharacterStat stat = other.GetComponent <CharacterStat>(); if (stat != null) { stat.OnDamage(bulletStat.totalDamage); } if (bulletStat.isFlinch) { other.SendMessage("Flinch", transform.rotation * dirction, SendMessageOptions.DontRequireReceiver); } } else if (other.CompareTag("Player") && bulletStat.attacker.CompareTag("Enemy")) { CharacterStat stat = other.GetComponent <CharacterStat>(); if (stat != null) { stat.OnDamage(bulletStat.totalDamage); } if (bulletStat.isFlinch) { other.SendMessage("Flinch", transform.rotation * dirction, SendMessageOptions.DontRequireReceiver); } } Destroy(gameObject); }