Context Menus & Progress Bars
We now have a context menu UI for in-game actions, right click on an item to activate Database view has a progress bar (finally!) Data structures for Megacorps and loadouts Towing task complete? needs testing
This commit is contained in:
parent
ab8aa5fb9a
commit
c24c155673
93 changed files with 1410 additions and 324 deletions
|
|
@ -17,7 +17,7 @@ public abstract class AgentTask : DatabaseEntry
|
|||
[JsonProperty("zone"), Key(2)]
|
||||
public Guid Zone;
|
||||
|
||||
[JsonProperty("assignedEntity"), Key(3)]
|
||||
[JsonProperty("reserved"), Key(3)]
|
||||
public bool Reserved;
|
||||
|
||||
[IgnoreMember] public abstract TaskType Type { get; }
|
||||
|
|
|
|||
|
|
@ -12,15 +12,19 @@ public class StationTowing : AgentTask
|
|||
[IgnoreMember] public override TaskType Type => TaskType.Tow;
|
||||
|
||||
[JsonProperty("station"), Key(4)]
|
||||
private Guid _station;
|
||||
public Guid Station;
|
||||
|
||||
[JsonProperty("targetOrbit"), Key(5)]
|
||||
private Guid _targetOrbit;
|
||||
[JsonProperty("orbitParent"), Key(5)]
|
||||
public Guid OrbitParent;
|
||||
|
||||
[JsonProperty("orbitDistance"), Key(6)]
|
||||
public float OrbitDistance;
|
||||
|
||||
public StationTowing(Guid zone, Guid station, Guid targetOrbit)
|
||||
public StationTowing(Guid zone, Guid station, Guid orbitParent, float orbitDistance)
|
||||
{
|
||||
Zone = zone;
|
||||
_station = station;
|
||||
_targetOrbit = targetOrbit;
|
||||
Station = station;
|
||||
OrbitParent = orbitParent;
|
||||
OrbitDistance = orbitDistance;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using static Unity.Mathematics.math;
|
|||
public class VelocityMatch : AgentBehavior
|
||||
{
|
||||
public event Action OnMatch;
|
||||
public Guid TargetOrbit;
|
||||
public float2 TargetVelocity;
|
||||
private Thruster _thrust;
|
||||
private Turning _turning;
|
||||
private const float TargetThreshold = .1f;
|
||||
|
|
@ -21,12 +21,17 @@ public class VelocityMatch : AgentBehavior
|
|||
_thrust = Entity.Axes.Keys.FirstOrDefault(x => x is Thruster) as Thruster;
|
||||
_turning = Entity.Axes.Keys.FirstOrDefault(x => x is Turning) as Turning;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
OnMatch = null;
|
||||
}
|
||||
|
||||
public override void Update(float delta)
|
||||
{
|
||||
if (TargetOrbit != Guid.Empty && _thrust != null && _turning != null)
|
||||
if (_thrust != null && _turning != null)
|
||||
{
|
||||
var deltaV = _context.GetOrbitVelocity(TargetOrbit) - Entity.Velocity;
|
||||
var deltaV = TargetVelocity - Entity.Velocity;
|
||||
if(length(deltaV) < TargetThreshold)
|
||||
OnMatch?.Invoke();
|
||||
Entity.Axes[_turning] = TurningInput(deltaV);
|
||||
|
|
@ -39,7 +44,7 @@ public class VelocityMatch : AgentBehavior
|
|||
get
|
||||
{
|
||||
var velocity = length(Entity.Velocity);
|
||||
var deltaV = _context.GetOrbitVelocity(TargetOrbit) - Entity.Velocity;
|
||||
var deltaV = TargetVelocity - Entity.Velocity;
|
||||
|
||||
var stoppingTime = length(deltaV) / (_thrust.Thrust / Entity.Mass);
|
||||
var stoppingDistance = stoppingTime * (velocity / 2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue