start to change action system

This commit is contained in:
Vladimir Koshevarov
2022-08-18 16:07:06 +03:00
parent a9e1db4ac2
commit 9366aa479c
11 changed files with 31 additions and 49 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ namespace Assets.Scripts.Actions
DurationInTicks = durationTicks;
}
public abstract void ConsumeTick();
public abstract void ApplyAction(PlayerController playerController);
}
}
+2 -4
View File
@@ -2,14 +2,12 @@
{
public class Eat : BaseAction
{
private PlayerController playerController;
private int energyPerTick;
public Eat(PlayerController player, int duration, int energyPerTick, double cost) : base(duration)
public Eat(int duration, int energyPerTick, double cost) : base(duration)
{
this.playerController = player;
this.energyPerTick = energyPerTick;
}
public override void ConsumeTick()
public override void ApplyAction(PlayerController playerController)
{
playerController.foodEnergy.increase(energyPerTick);
}
+3 -5
View File
@@ -2,16 +2,14 @@
{
public class Relax : BaseAction
{
private PlayerController _playerController;
private int _energyPerTick;
public Relax(PlayerController player, int duration, int energyPerTick) : base(duration)
public Relax(int duration, int energyPerTick) : base(duration)
{
_playerController = player;
_energyPerTick = energyPerTick;
}
public override void ConsumeTick()
public override void ApplyAction(PlayerController playerController)
{
_playerController.restEnergy.increase(_energyPerTick);
playerController.restEnergy.increase(_energyPerTick);
}
}
}
+1 -1
View File
@@ -9,7 +9,7 @@
this.playerController = player;
this.energyPerTick = energyPerTick;
}
public override void ConsumeTick()
public override void ApplyAction(PlayerController playerController)
{
throw new System.NotImplementedException();
}