In my game I can take damage from an enemy sword, but so can my sword because it’s attached to my player. I can’t take it off my player in the Hierarchy because then it wont follow where I look. How would I go about not taking damage from my sword?
Here’s my Player’s code for colliding with the enemy sword:
private bool yesHurtMe = true;
void OnTriggerEnter(Collider other){
if (other.name == "Enemy Sword" && yesHurtMe == true){
will -= 20;
yesHurtMe = false;
}
}
void OnTriggerExit(Collider other){
if (other.name == "Enemy Sword" && yesHurtMe == false){
yesHurtMe = true;
}
will is my Health.