Removed universal GameContext references Refactored GameContext: It's now only responsible for item management. As such it's now called ItemManager GlobalData is gone, relevant settings are distributed amongst specialized settings classes Entities are no longer database entries, references to them are now direct - Zone is reponsible for storing them in ZonePacks Controller subtypes are now generic classes, class argument is task type Inventory is now a 2D grid instead of a list Entity temperature is now a 2D grid instead of a number Item sizes are now arbitrary shapes instead of a number Hardpoints are now arbitrary shapes instead Equipped items have their own temperatures Map view now displays sunlight colors Integrated Allegorithmic Substance Plugin Imported Djinni ship and assigned Substance materials Removed Node Editor framework (might come back later but needs work to integrate with behavior system)
30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.Mathematics;
|
|
using static Unity.Mathematics.math;
|
|
|
|
public abstract class AgentBehavior
|
|
{
|
|
public abstract void Update(float delta);
|
|
|
|
protected float ThrustInput(float2 deltaV) =>
|
|
saturate( // Input must be normalized
|
|
pow( // Apply specificity as exponent to dot product to control how specific the direction needs to be
|
|
saturate( // Discard negative dot product (we're facing away from desired direction)
|
|
dot(normalize(Entity.Direction), normalize(deltaV))), // Cosine of angle between direction and deltaV
|
|
ControllerData.ThrustSpecificity)
|
|
* length(deltaV) * ControllerData.ThrustSensitivity);
|
|
|
|
protected float TurningInput(float2 deltaV) => clamp(-Entity.Direction.AngleDiff(deltaV) * ControllerData.TurningSensitivity, -1, 1);
|
|
|
|
protected ControllerData ControllerData;
|
|
protected ItemManager Context;
|
|
protected Entity Entity;
|
|
|
|
public AgentBehavior(ItemManager context, Entity entity, ControllerData controllerData)
|
|
{
|
|
Context = context;
|
|
Entity = entity;
|
|
ControllerData = controllerData;
|
|
}
|
|
}
|