The problem is, let’s say an example:
I have 10 coins. 5 Health costs 5 coins. I have 10/20 health. And when i buy the health, i buy to full, and use all my money.
How can i make it only buy is ONCE?
Here’s the piece of my code that uses the shop:
function OnGUI () {
if(insideEngine == true) {
GUI.Box (Rect (500,400,100,70), "Press F to
Fix Engine
Cost: 5M");
if(Input.GetKeyDown(“f”)) {
if(Stats.scrapMetal > 5) {
if(Stats.shipHealth < 1000) {
Stats.scrapMetal -= 5;
Stats.shipHealth += 100;
}
}
}
}
}