AiMalgam Core 1.1.0
API documentation for the generic Unity3D AI System
Public Member Functions | Public Attributes | List of all members
NikosAssets.AiMalgam.Settings.Comparers.AiMalgamBaseComparison Class Referenceabstract

A helper AiMalgamNode used to compare AiMalgamEntitys against each other for targeting and sorting purposes Inherit this and add custom implementations! Is visible and assignable in the Unity inspector More...

Public Member Functions

abstract int Compare (AiMalgamEntity entityA, AiMalgamEntity entityB, AiMalgamEntity checkAgainst)
 Compares 2 agents against each other More...
 
virtual AiMalgamEntity GetResult (List< AiMalgamEntity > targets, AiMalgamEntity checkAgainst, bool sortOriginalList)
 Calls the Compare method and returns the first element (index 0) after sorting More...
 
- Public Member Functions inherited from NikosAssets.AiMalgam.Settings.AiMalgamNode
override void OnOpen ()
 Called if the AiMalgamNodeGraph hosting this Node is opened
 
virtual void NotifyOnNodeChanged ()
 A helper method to notify node value changes and emit the OnNodeChanged event
 
override object GetValue (NodePort port)
 Used in the AiMalgamNodeGraph. More...
 
virtual void ResetMarkingInGraph (AiMalgamEntity requester, bool forceRepaint=false)
 EDITOR ONLY EFFECT. Reset the node's visuals in the AiMalgamNodeGraph More...
 
virtual void MarkInGraph (AiMalgamEntity requester, bool acceptedOrFailed, bool forceRepaint=false)
 EDITOR ONLY EFFECT. Set the node's visuals in the AiMalgamNodeGraph (accepted or failed) More...
 
virtual void MarkInGraph (AiMalgamEntity requester, Color markColor, bool forceRepaint=false)
 EDITOR ONLY EFFECT. Set the node's visuals in the AiMalgamNodeGraph More...
 

Public Attributes

AiMalgamBaseComparison output
 Used in the AiMalgamNodeGraph. Do not temper with it!
 

Additional Inherited Members

- Protected Member Functions inherited from NikosAssets.AiMalgam.Settings.AiMalgamNode
override void Reset ()
 
override void OnEnable ()
 
override void Awake ()
 
override void OnValidate ()
 
- Events inherited from NikosAssets.AiMalgam.Settings.AiMalgamNode
virtual Action< AiMalgamNodeOnNodeChanged
 Emitted, if the node values where changed (OnValidate())
 

Detailed Description

A helper AiMalgamNode used to compare AiMalgamEntitys against each other for targeting and sorting purposes Inherit this and add custom implementations! Is visible and assignable in the Unity inspector

Member Function Documentation

◆ Compare()

abstract int NikosAssets.AiMalgam.Settings.Comparers.AiMalgamBaseComparison.Compare ( AiMalgamEntity  entityA,
AiMalgamEntity  entityB,
AiMalgamEntity  checkAgainst 
)
pure virtual

Compares 2 agents against each other

Parameters
entityA
entityB
checkAgainstThe AiMalgamEntity, entityA and entityB may or may not compare to (depends on the specific implementation)
Returns
-1 = entityB won 0 = equal 1 = entityA won

◆ GetResult()

virtual AiMalgamEntity NikosAssets.AiMalgam.Settings.Comparers.AiMalgamBaseComparison.GetResult ( List< AiMalgamEntity targets,
AiMalgamEntity  checkAgainst,
bool  sortOriginalList 
)
virtual

Calls the Compare method and returns the first element (index 0) after sorting

Parameters
targetsThe targets to compare and sort
checkAgainstthe AiMalgamEntity to check against the targets (if needed that is)
sortOriginalListshould the passed targets list be sorted or should a copy of it be created? sorting the passed list is faster
Returns
null if the targets list is empty or null The first AiMalgamEntity at index 0 after sorting