Polarith AI
1.7
PerceptBehaviour< T > Class Template Referenceabstract

Description

This class extends the MoveBehaviour so that it is able to work with IPercept<T> instances which are relevant for the associated agent (back-end class).

In addition, for derived classes, it requires the implementation of the Self property.

The percept data allows this behaviour to interact with the environment of the associated agent to fulfill its purpose. These data might come from an AIMFilter<T> instance (which obtains its data from an AIMPerceiver<T> and its associated AIMEnvironment).

A PerceptBehaviour<T> can be marked as thread-safe in its corresponding front-end class through setting AIMBehaviour.ThreadSafe to true. If you do this, be sure not to use reference types of the Unity scripting API and not to make any possibly unsafe variable writes. If at least one behaviour is not marked AIMBehaviour.ThreadSafe, the whole agent will not be part of the multithreading (Pro only).

Base back-end class of every derived AIMPerceptBehaviour<T>.

Template Parameters
TType of the processed percepts.
Type Constraints
T :IPercept<GameObject> 
T :new() 
Inheritance diagram for PerceptBehaviour< T >:
MoveBehaviour CriteriaBehaviour IBehaviour

Public Fields

readonly IList< T > Percepts = new List<T>()
 All percepts which are relevant for an agent. More...
 
Context Context
 Reference for quick access to the associated context instance. More...
 
const int CentralOrder = 1000
 The minimum Order for behaviours which should be processed before behaviours using LastOrder but after all other behaviours. More...
 
const int LastOrder = 2000
 The minimum Order for behaviours which should be processed at last. More...
 

Protected Fields

Problem intermediate = new Problem()
 Holds the intermediate result of this behaviour which can be applied to the context map at the end of an update step using BlendValues(LayerBlendingType, int). More...
 
bool enabled
 Determines if this IBehaviour is active or inactive. More...
 

Properties

abstract T Self [get, set]
 The data of the associated agent itself. More...
 
bool Enabled [get, set]
 Determines if this IBehaviour is active or inactive. More...
 
int Order [get, set]
 Specifies the execution order of this behaviour. More...
 

Public Methods

abstract void Behave ()
 Should be used to write/modify objective values for an IProblem<T> instance hold by a class implementing IContext<TValue, TStructure>. More...
 

Public Static Methods

static float MapSpecial (MappingType mapping, float min, float max, float value)
 Maps a value lying between min and max to a resulting value between 0 and 1. More...
 
static float MapSpecialSqr (MappingType mapping, float sqrMin, float sqrMax, float sqrValue)
 Maps a sqrValue lying between sqrMin and sqrMax to a resulting value between 0 and 1, whereby all the given parameters are expected to be squared. More...
 

Protected Methods

float MapBySensitivity (MappingType mapping, Structure structure, Vector3 direction, float sensitivityOffset=0.0f)
 Maps (magnitude) values by sensitivity so that the Structure.Sensitivity (plus the given sensitivityOffset ) is used as similarity threshold for the angle between the given direction and the Structure.Direction. More...
 
float MapBySensitivityPlane (MappingType mapping, Structure structure, Vector3 planeDirection1, Vector3 planeDirection2, float offset, float sensitivityOffset=0.0f)
 Maps (magnitude) values by sensitivity so that the Structure.Sensitivity (plus the given sensitivityOffset ) is used as similarity threshold for the smallest angle between a plane defined by planeDirection1 , planeDirection2 and the Structure.Direction. More...
 
void WriteValue (ValueWritingType valueWriting, int objectiveIndex, int valueIndex, float value, bool intermediate=false)
 Writes objective values to the Context.Problem as specified with valueWriting . More...
 
void BlendValues (LayerBlendingType layerBlending, int objectiveIndex)
 Writes the values of the intermediate to the actual Context.Problem. More...
 
Imprint