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
|
|
@ -26,12 +26,14 @@ public class Thruster : IAnalogBehavior
|
|||
public Entity Entity { get; }
|
||||
public Gear Item { get; }
|
||||
public GameContext Context { get; }
|
||||
|
||||
public float Thrust { get; private set; }
|
||||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
private ThrusterData _data;
|
||||
|
||||
private float _thrust;
|
||||
private float _input;
|
||||
|
||||
public Thruster(GameContext context, ThrusterData data, Entity entity, Gear item)
|
||||
{
|
||||
|
|
@ -43,7 +45,7 @@ public class Thruster : IAnalogBehavior
|
|||
|
||||
public void SetAxis(float value)
|
||||
{
|
||||
_thrust = saturate(value);
|
||||
_input = saturate(value);
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
@ -52,8 +54,9 @@ public class Thruster : IAnalogBehavior
|
|||
|
||||
public void Update(float delta)
|
||||
{
|
||||
Entity.Velocity += Entity.Direction * _thrust * Context.Evaluate(_data.Thrust, Item, Entity) / Entity.Mass * delta;
|
||||
Entity.AddHeat(_thrust * Context.Evaluate(_data.Heat, Item, Entity) * delta);
|
||||
Entity.VisibilitySources[this] = _thrust * Context.Evaluate(_data.Visibility, Item, Entity);
|
||||
Thrust = Context.Evaluate(_data.Thrust, Item, Entity);
|
||||
Entity.Velocity += Entity.Direction * _input * Thrust / Entity.Mass * delta;
|
||||
Entity.AddHeat(_input * Context.Evaluate(_data.Heat, Item, Entity) * delta);
|
||||
Entity.VisibilitySources[this] = _input * Context.Evaluate(_data.Visibility, Item, Entity);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue