Hauling Task
Added a control module which enables drones to haul items from colony to colony Added confirmation dialog for actions which require confirmation, can have fields added to it just like a PropertiesPanel Moving items between inventories now displays confirmation dialog
This commit is contained in:
parent
a901a8e829
commit
991d411c91
24 changed files with 1965 additions and 2193 deletions
|
|
@ -43,6 +43,7 @@ public abstract class ControllerBase : IBehavior, IController, IInitializableBeh
|
|||
protected List<SimplifiedZoneData> Path;
|
||||
protected Guid Task;
|
||||
protected bool Moving;
|
||||
protected bool Waiting;
|
||||
|
||||
private GameContext _context;
|
||||
private Entity _entity;
|
||||
|
|
@ -50,6 +51,8 @@ public abstract class ControllerBase : IBehavior, IController, IInitializableBeh
|
|||
private MovementPhase _movementPhase;
|
||||
private Action _onFinishMoving;
|
||||
private bool _spaceworthy;
|
||||
private float _waitTime;
|
||||
private Action _onFinishWaiting;
|
||||
|
||||
public ControllerBase(GameContext context, ControllerData data, Entity entity)
|
||||
{
|
||||
|
|
@ -88,6 +91,18 @@ public abstract class ControllerBase : IBehavior, IController, IInitializableBeh
|
|||
GoHome();
|
||||
}
|
||||
}
|
||||
|
||||
if (Waiting)
|
||||
{
|
||||
_waitTime -= delta;
|
||||
if (_waitTime < 0)
|
||||
{
|
||||
Waiting = false;
|
||||
_onFinishWaiting?.Invoke();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Moving)
|
||||
{
|
||||
|
|
@ -165,6 +180,13 @@ public abstract class ControllerBase : IBehavior, IController, IInitializableBeh
|
|||
}));
|
||||
}
|
||||
|
||||
public void Wait(float time, Action onFinish = null)
|
||||
{
|
||||
_waitTime = time;
|
||||
Waiting = true;
|
||||
_onFinishWaiting = onFinish;
|
||||
}
|
||||
|
||||
public void MoveTo(Entity entity, bool matchVelocity = true, Action onFinish = null)
|
||||
{
|
||||
TargetPosition = () => entity.Position;
|
||||
|
|
|
|||
Loading…
Reference in a new issue