I've a projectile that I want to work for two tags "Enemy" and "Player" but after a bit of Google search: it doesn't seem like there is a way to tag them both (unless I'm mistaken?) but in that case, then how would I go about changing this part of the script, so that the projectile works on both the enemies and the player, when they are getting shot at?
void OnCollisionEnter (Collision collisionTemp) {
if(collisionTemp.gameObject.tag == "Enemy") {
collisionTemp.gameObject.SendMessage("TakeDamage", damage, SendMessageOptions.DontRequireReceiver);
ContactPoint contact = collisionTemp.contacts[0];
Quaternion rot = Quaternion.FromToRotation(Vector3.up, contact.normal);
Vector3 pos = contact.point;
Instantiate (lasterHitFXPrefab, pos, rot);
Destroy (gameObject);
}
}
↧