Scoring system based on sorting item in correct container
Hi, I'm trying to create a scoring system in a game where the player needs to sort food into the correct containers, if he/she throws items in the wrong container they will loose points, consequently if they throw it in the right one they gain points, I'm trying to change the score variable based on collisions between the thrown item and the collision box container but I can't figure out a way to check if the the container the item has been thrown into is the right one and vise versa, considering that every container is going to have a different combination of accepted and not accepted items
How could I design this? I tried comparing tags, but I can't use the same script for different containers since I can't use a string variable to check the item's tag
//The acceptedItem variable is a string set in the unity editor
// for instance if "banana" == "apple" than that is not an accepted item
if (collision.collider.gameObject.tag == acceptedItem)
{
Destroy(collision.gameObject);
return;
}
else
{
Debug.Log("Wrong Collider");
Destroy(collision.gameObject);
Debug.Log("" + gameObject.name.ToString());
}
The above code doesn't work since the tag== only works when you do tag == "tag"
Thanks to anybody who decides to at least read this