added Game UI Controller

Show money on UI, buy items
This commit is contained in:
Vladimir Koshevarov
2022-10-18 16:55:38 +03:00
parent 32cdf47d4a
commit fc8393b29f
6 changed files with 78 additions and 17 deletions
+7 -4
View File
@@ -2,14 +2,17 @@
{
public class Eat : BaseAction
{
private int energyPerTick;
public Eat(int duration, int energyPerTick, double cost) : base(duration)
private double _price;
private int _energyPerTick;
public Eat(int duration, int energyPerTick, double price) : base(duration)
{
this.energyPerTick = energyPerTick;
_price = price;
_energyPerTick = energyPerTick;
}
public override void ApplyAction(PlayerController playerController)
{
playerController.foodEnergy.increase(energyPerTick);
playerController.foodEnergy.increase(_energyPerTick);
playerController.money.deduct(_price);
}
}
}