So, I recently went through the RPG series, I really liked it by the way. I am definitely expanding upon it and I added a Health potion item. To do this, I basically created a Potion script that inherited from the Item class and I am overriding the Use method. I figured out a way to get everything to work but, I don’t feel like it is necessarily the best way to go about the process. Here is basically what I came up with:
Potion class Use method:
public override void Use()
CharacterStats myStats = PlayerManager.instance.player.GetComponent(CharacterStats);
if (myStats != null)
(The Heal method basically just adds the healAmount to currentHealth)
Because the currentHealth variable has a private setter on the CharacterStats script, I can’t really think of another way to do this. Is this a good way to go about doing this or might there be a better way to do this?
Also, I would add code tags but, I do not see them on the Text editor bar where I read they would be…