Fix shop System

add food indicator
This commit is contained in:
Vladimir Koshevarov
2022-11-17 17:24:00 +02:00
parent be3161d7e4
commit c8047bd170
16 changed files with 663 additions and 286 deletions
+15 -15
View File
@@ -1,16 +1,16 @@
namespace Assets.Scripts.Actions
{
public abstract class BaseAction
{
protected int DurationInTicks { get; }
protected int ElapsedTicks { get; }
protected BaseAction(int durationTicks)
{
DurationInTicks = durationTicks;
}
public abstract void ApplyAction(PlayerController playerController);
}
namespace Assets.Scripts.Actions
{
public abstract class BaseAction
{
protected int DurationInTicks { get; }
protected int ElapsedTicks { get; }
protected BaseAction(int durationTicks)
{
DurationInTicks = durationTicks;
}
public abstract void ApplyAction(PlayerManager playerController);
}
}
+5 -5
View File
@@ -5,17 +5,17 @@ namespace Assets.Scripts.Actions
public class Eat : BaseAction, ISellableItem
{
public float Price { get; private set; }
private int _energyPerTick;
public Eat(int duration, int energyPerTick, float price) : base(duration)
private int _energy;
public Eat(int duration, int energy, float price) : base(duration)
{
Price = price;
_energyPerTick = energyPerTick;
_energy = energy;
}
public override void ApplyAction(PlayerController playerController)
public override void ApplyAction(PlayerManager playerController)
{
playerController.foodEnergy.increase(_energyPerTick);
playerController.food.increase(_energy);
}
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
{
_energyPerTick = energyPerTick;
}
public override void ApplyAction(PlayerController playerController)
public override void ApplyAction(PlayerManager playerController)
{
playerController.energy.increase(_energyPerTick);
}
+17 -17
View File
@@ -1,17 +1,17 @@
namespace Assets.Scripts.Actions
{
public class Work : BaseAction
{
private PlayerController playerController;
private int energyPerTick;
public Work(PlayerController player, int duration, int energyPerTick) : base(duration)
{
this.playerController = player;
this.energyPerTick = energyPerTick;
}
public override void ApplyAction(PlayerController playerController)
{
throw new System.NotImplementedException();
}
}
}
namespace Assets.Scripts.Actions
{
public class Work : BaseAction
{
private PlayerManager playerController;
private int energyPerTick;
public Work(PlayerManager player, int duration, int energyPerTick) : base(duration)
{
this.playerController = player;
this.energyPerTick = energyPerTick;
}
public override void ApplyAction(PlayerManager playerController)
{
throw new System.NotImplementedException();
}
}
}