So it’s a little more complex than the title in the grand scheme of it all. I want to have a spell that attacks up to 6 enemies in an area and they can be hit a maximum of 1 times.
So far I had
bool enemyInBounds = false;
bool enemyTargeted = false;
void SpellOne()
{
if (enemyInBounds == true)
{
for (int i = 0; i < 6; i++)
{
//need to make sure they're unique
// apply damage and shoot projectile
}
}
I wasn’t sure how to check if they were inside the sphere collider I had on the player besides
void OnTriggerStay(Collider Other) //might work. not sure if enemyInBounds is assigned to the other object or not
{
if (Other.gameObject.tag == "Enemy")
enemyInBounds = true;
}
void OnTriggerExit(Collider Other)
{
if (Other.gameObject.tag == "Enemy")
enemyInBounds = false;
}
I’m not sure if this is even the correct way to go about it. Any ideas on the logic?