Control Modules & Job System

Agent behaviors are no longer hard coded but instead created by equippable control modules
Game Context has a job system which assigns appropriate tasks to drone control modules
This commit is contained in:
hyperion51 2020-05-07 03:53:54 +01:00
commit ab8aa5fb9a
27 changed files with 480 additions and 190 deletions

View file

@ -21,6 +21,8 @@ public class VelocityLimit : IBehavior
public Entity Entity { get; }
public Gear Item { get; }
public GameContext Context { get; }
public float Limit { get; private set; }
public BehaviorData Data => _data;
@ -40,8 +42,8 @@ public class VelocityLimit : IBehavior
public void Update(float delta)
{
var limit = Context.Evaluate(_data.TopSpeed, Item, Entity);
if (length(Entity.Velocity) > limit)
Entity.Velocity = normalize(Entity.Velocity) * limit;
Limit = Context.Evaluate(_data.TopSpeed, Item, Entity);
if (length(Entity.Velocity) > Limit)
Entity.Velocity = normalize(Entity.Velocity) * Limit;
}
}