Making a potion class (change values two objects down)
Hello i was just wondering what is the generaly good way to do a potion in a game cause i feel what i got right now is not that good. This doesnt really work with potions over time which i could go around by adding effects over time to player but I was just wondering if this is the right way to do it.
Example :
class Player
{
Inventory inventory;
Health health;
}
class Inventory
{
Item[] bag = new item[30];
bag[0] = new Potion();
}
abstract class Item { ... }
class Potion : Item
{
public void Use()
{
GameObject.Find("Player").Player.health.RestoreHealth(value);
}
}
Comment