Unstable v0.1100.0.4 (November 11th 2020)

This commit is contained in:
Joonas Rikkonen
2020-11-06 20:12:15 +02:00
parent 6b36bf809d
commit b772654326
297 changed files with 12502 additions and 4277 deletions
@@ -0,0 +1,49 @@
#nullable enable
namespace Barotrauma.MapCreatures.Behavior
{
class BallastFloraStateMachine
{
private readonly BallastFloraBehavior parent;
public BallastFloraStateMachine(BallastFloraBehavior parent)
{
this.parent = parent;
}
private IBallastFloraState? lastState;
public IBallastFloraState? State;
public void EnterState(IBallastFloraState newState)
{
lastState = State;
State?.Exit();
newState.Enter();
State = newState;
}
public void Update(float deltaTime)
{
if (State == null)
{
EnterState(new GrowIdleState(parent));
return;
}
State.Update(deltaTime);
switch (State.GetState())
{
case ExitState.Running:
break;
case ExitState.ReturnLast when lastState != null && lastState.GetState() == ExitState.Running:
EnterState(lastState);
break;
default:
EnterState(new GrowIdleState(parent));
break;
}
}
}
}