Class structure for diferent item types and items that do different things.
Example: I have 2 items tagged with "Item". One is an ammo pickup, the other is a health pickup. When the player touches one of the items, the item executes it's fuction (either healing or adding ammo). I thought of having it work by inheritance, with a parent class called Item and 2 child classes called AmmoItem and HealingItem, but because the Item class can't work with the childs' functions, my plan doesn't work. Any ideas on how to do this?
They all do the same thing, bump into it and an action is performed.
I'd just have an item class Pickup (String itemType, GameObject item)
Then have something like:
If (itemType== health) { Add health. Destroy item} Else if (itemType == Ammo) { Add ammo. Destroy item }
I'm probably misunderstanding the request, but it feels like you might be over engineering the solution.