An abstract class in Root.Township, Alta.Intelligence.
Asset for something an AI agent can measure about a target (distance, visibility and so on) as a number. Sense assets are loaded from Resources/Senses.
Constructors
| Member | What it is |
|---|
protected Sense() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private static List<Sense> all | Every sense registered by Initialize. Exposed as All. |
private SenseOld oldEquivalent | The legacy SenseOld enum value this sense replaces, or None. |
private static Dictionary<SenseOld, Sense> oldMapping | Maps legacy SenseOld values to their sense assets, for GetSense. |
Properties
| Member | What it is |
|---|
static List<Sense> All { get; } | Every sense that has been initialized. |
Methods
| Member | What it is |
|---|
abstract float Get(IAgent requester, ITarget target) | The sense's value for a target, from the asking agent's point of view. |
virtual float GetInverseLerp(IAgent requester, ITarget target, float from, float to) | The value mapped to 0 to 1 between from and to, clamped. |
static Sense GetSense(SenseOld old) | The sense that replaces an old SenseOld enum value, or null. |
virtual void Initialize() | Adds the sense to All and maps its old enum value. |
static void InitializeAll() | Loads every sense under Resources/Senses and initializes them. |
1 private and internal method
| Member | What it is |
|---|
private void OnValidate() | Editor: re-registers the sense and renames the asset to match its old enum value if it has one. |
Used in
Members of other types that take, return or hold a Sense: