I have a script attached to numerous NPCs and I want to send a message to turn on the script for ONLY the NPC that I have collided with and not anyone else. I don't want the 'NpcBattleScript' to turn on for every NPC that has 'npc' tag or has the script attached. I also want to turn off that script from within the script after it has finished doing a particular thing. Can anyone point me in the right direction?
I know:
if(hit.collider.gameObject.tag == "npc")
{
// in here I want to say, turn on NpcBattleScript
}
in the other script I want something like:
if (battleOver = true)
{
//turn off this script
}
↧