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:
parent
6aeb2ae280
commit
ab8aa5fb9a
27 changed files with 480 additions and 190 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue