AiMalgam Core 1.1.0
API documentation for the generic Unity3D AI System
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType > Class Template Reference

The base AiMalgamBaseEngineWrapper with core implementations to handle its IAiMalgamBaseActionWrappers More...

Public Member Functions

override List< IAiMalgamBaseActionWrapperGetStableActiveActions ()
 Get IAiMalgamBaseActionWrappers that are actively running and not in the remove queue More...
 
override AiMalgamApplyActionSettingResult ValidateSettings (AiMalgamBaseSettings settings)
 Validate the given AiMalgamBaseSettings by checking its AiMalgamBaseSettings.conditionToEnter and if the current AiMalgamEntity.currentStates allow it. More...
 
virtual void AddActionsQueue (List< ActionType > actions)
 
override void RemoveAllActiveActionsAndStatesQueue ()
 Clear all AiMalgamStates attached on this AiMalgamEntity and their represented IAiMalgamBaseActionWrappers on this Engine More...
 
virtual void RemoveActionsQueue (List< ActionType > actionsToRemove)
 
virtual void Tick (BlackboardType blackboard)
 Call this to RemoveActions from the _actionsRemoveQueue, AddActions from the _actionsAddQueue and finally RunActions maintained in Actions More...
 
virtual void ActionsActiveBlockedByState (AiMalgamState state)
 Dispose all ActionTypes from Actions that are blocked by state More...
 
virtual bool CanStackSetting (AiMalgamBaseSettings settings, List< ActionType > actionTypes)
 Check if the given settings can be added or stacked against the actionTypes More...
 
virtual bool CanStackAction (ActionType action, List< ActionType > actionTypes)
 Check if the given action .IAiMalgamBaseActionWrapper.Settings can be added or stacked against the actionTypes More...
 
- Public Member Functions inherited from NikosAssets.AiMalgam.Systems.Engines.AiMalgamBaseEngineWrapper
abstract AiMalgamApplyActionSettingResult ApplySettings (AiMalgamBaseSettings settings)
 Apply the AiMalgamBaseSettings to this Engine and convert it to its respective IAiMalgamBaseActionWrapper More...
 
abstract AiMalgamApplyActionSettingResult ValidateSettings (AiMalgamBaseSettings settings)
 Validate the given AiMalgamBaseSettings by checking its AiMalgamBaseSettings.conditionToEnter and if the current AiMalgamEntity.currentStates allow it. More...
 
abstract void RemoveAllActiveActionsAndStatesQueue ()
 Clear all AiMalgamStates attached on this AiMalgamEntity and their represented IAiMalgamBaseActionWrappers on this Engine More...
 
abstract List< IAiMalgamBaseActionWrapperGetStableActiveActions ()
 Get IAiMalgamBaseActionWrappers that are actively running and not in the remove queue More...
 

Protected Member Functions

virtual void Awake ()
 
virtual void Start ()
 
virtual void OnDestroy ()
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
virtual void Reset ()
 
virtual void OnValidate ()
 
virtual void AutoFill ()
 Automatically fills required and empty fields of this instance
 
virtual void UnsubscribeEntityStateChanged (AiMalgamEntity entity)
 
virtual void CheckSubscribeEntityStateChanged (AiMalgamEntity entity)
 Check if we should and can subscribe to AiMalgamState changes on AiMalgamEntity and subscribe if possible More...
 
virtual void UpdateSupportedActionType ()
 
virtual void OnAiMalgamEntityStateChanged (AiMalgamBaseEngineWrapper engineWrapper, AiMalgamState state, bool added)
 Dispose specific ActionTypes running in _actions if conditions are met More...
 
virtual void SortActionsByPriorities (BlackboardType blackboard)
 
virtual bool AddActions (BlackboardType blackboard)
 
virtual void RemoveActions (BlackboardType blackboard)
 
virtual void RunActions (BlackboardType blackboard)
 

Protected Attributes

AiMalgamEntity _aiMalgamEntity
 The hosting AiMalgamEntity
 
AiMalgamEntity _prevAiMalgamEntity
 Used if the developer changed _aiMalgamEntity field or AiMalgamEntity property (at runtime)
 
bool _subscribeToAnyStateChangedOnEntity = true
 Should any AiMalgamState change on the AiMalgamEntity be reacted upon (for example dispose specific running ActionTypes)?
 
string _actionTypeSupported = ""
 Which custom ActionType can this Engine be mapped to? Used to generate the ActionTypeSupportedHash for mapping
 
int _actionTypeSupportedHash = -1
 Used to map the compatible custom ActionType to this Engine
 
bool _removeAllActiveActionsAndStates
 Clear all ActionTypes in this Engine next Tick
 
List< ActionType > _actions = new List<ActionType>()
 The current running ActionTypes
 
Queue< ActionType > _actionsAddQueue = new Queue<ActionType>()
 The next upcoming ActionTypes to be added in Actions next Tick
 
Queue< ActionType > _actionsRemoveQueue = new Queue<ActionType>()
 The next ActionTypes to be removed from the Actions list next Tick
 

Properties

override AiMalgamEntity AiMalgamEntity [get, set]
 The hosting AiMalgamEntity. Setting this property updates the subscriptions (_subscribeToAnyStateChangedOnEntity) of this instance accordingly
 
override string ActionTypeSupported [get, protected set]
 Which custom ActionType can this Engine be mapped to? Setting this property generates the ActionTypeSupportedHash for the mapping mechanic
 
override int ActionTypeSupportedHash [get]
 Used to map the compatible custom ActionType to this Engine
 
abstract BlackboardType Blackboard [get, set]
 The for the ActionType needed IAiMalgamBlackboard type that has to be injected in the IAiMalgamBaseActionWrapper and maintained in this Engine
 
List< ActionType > Actions [get]
 The current running ActionTypes
 
Queue< ActionType > ActionsAddQueue [get]
 The next upcoming ActionTypes to be added in Actions next Tick
 
Queue< ActionType > ActionsRemoveQueue [get]
 The next ActionTypes to be removed from the Actions list next Tick
 
- Properties inherited from NikosAssets.AiMalgam.Systems.Engines.AiMalgamBaseEngineWrapper
abstract string ActionTypeSupported [get, protected set]
 Which custom IAiMalgamBaseActionWrapper can this Engine be mapped to? Setting this property generates the ActionTypeSupportedHash for the mapping mechanic
 
abstract int ActionTypeSupportedHash [get]
 Used to map the compatible custom IAiMalgamBaseActionWrapper to this Engine
 
abstract AiMalgamEntity AiMalgamEntity [get, set]
 The hosting AiMalgamEntity
 

Detailed Description

The base AiMalgamBaseEngineWrapper with core implementations to handle its IAiMalgamBaseActionWrappers

Template Parameters
ActionTypeThe for this Engine designated and supported ActionType
BlackboardTypeThe for the ActionType needed IAiMalgamBlackboard type that has to be injected in the IAiMalgamBaseActionWrapper and maintained in this Engine
Type Constraints
BlackboardType :IAiMalgamBlackboard 
ActionType :AiMalgamBaseAction<BlackboardType> 

Member Function Documentation

◆ ActionsActiveBlockedByState()

virtual void NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.ActionsActiveBlockedByState ( AiMalgamState  state)
virtual

Dispose all ActionTypes from Actions that are blocked by state

Parameters
stateThe blocking AiMalgamState

◆ CanStackAction()

virtual bool NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.CanStackAction ( ActionType  action,
List< ActionType >  actionTypes 
)
virtual

Check if the given action .IAiMalgamBaseActionWrapper.Settings can be added or stacked against the actionTypes

Parameters
actionThe action .IAiMalgamBaseActionWrapper.Settings we want to add to Actions
actionTypes
Returns
The ActionTypes that may or may not already contain the same AiMalgamBaseSettings as settings

◆ CanStackSetting()

virtual bool NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.CanStackSetting ( AiMalgamBaseSettings  settings,
List< ActionType >  actionTypes 
)
virtual

Check if the given settings can be added or stacked against the actionTypes

Parameters
settingsThe AiMalgamBaseSettings we want to add to Actions
actionTypes
Returns
The ActionTypes that may or may not already contain the same AiMalgamBaseSettings as settings

◆ CheckSubscribeEntityStateChanged()

virtual void NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.CheckSubscribeEntityStateChanged ( AiMalgamEntity  entity)
protectedvirtual

Check if we should and can subscribe to AiMalgamState changes on AiMalgamEntity and subscribe if possible

Parameters
entityThe NikosAssets.AiMalgam.AiMalgamEntity to subscribe to

◆ GetStableActiveActions()

override List< IAiMalgamBaseActionWrapper > NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.GetStableActiveActions ( )
virtual

Get IAiMalgamBaseActionWrappers that are actively running and not in the remove queue

Returns
A list of IAiMalgamBaseActionWrappers

Implements NikosAssets.AiMalgam.Systems.Engines.AiMalgamBaseEngineWrapper.

◆ OnAiMalgamEntityStateChanged()

virtual void NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.OnAiMalgamEntityStateChanged ( AiMalgamBaseEngineWrapper  engineWrapper,
AiMalgamState  state,
bool  added 
)
protectedvirtual

Dispose specific ActionTypes running in _actions if conditions are met

Parameters
engineWrapperThe emitting AiMalgamBaseEngineWrapper. Abort, if the emitter was this.
stateThe AiMalgamState that was added or removed
addedstate was removed from or added to our AiMalgamEntity

◆ RemoveAllActiveActionsAndStatesQueue()

override void NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.RemoveAllActiveActionsAndStatesQueue ( )
virtual

Clear all AiMalgamStates attached on this AiMalgamEntity and their represented IAiMalgamBaseActionWrappers on this Engine

Implements NikosAssets.AiMalgam.Systems.Engines.AiMalgamBaseEngineWrapper.

◆ Tick()

virtual void NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.Tick ( BlackboardType  blackboard)
virtual

Call this to RemoveActions from the _actionsRemoveQueue, AddActions from the _actionsAddQueue and finally RunActions maintained in Actions

Parameters
blackboardThe BlackboardType to inject to the ActionTypes

◆ ValidateSettings()

override AiMalgamApplyActionSettingResult NikosAssets.AiMalgam.Systems.Engines.AiMalgamEntityBaseEngine< ActionType, BlackboardType >.ValidateSettings ( AiMalgamBaseSettings  settings)
virtual

Validate the given AiMalgamBaseSettings by checking its AiMalgamBaseSettings.conditionToEnter and if the current AiMalgamEntity.currentStates allow it.

Parameters
settingsValidate those
Returns
AiMalgamApplyActionSettingResult

Implements NikosAssets.AiMalgam.Systems.Engines.AiMalgamBaseEngineWrapper.