Let's test our DecisionMgr
class by integrating these custom conditions and responses into an NPC instance.
Find the NPC instance from earlier, and select the
npcScript
class.Note that the
DecisonMgr
reference is embedded in the class (instead of waiting for a reference to the GameObject). Click on the triangle, and notice that you can see the public interactions list that this class contains. By setting the size member variable, we can design and tailor the interactions for this NPC'sDecisionMgr
to perfectly match our gameplay needs.Click on the size field of the interactions list, and set it to
2
. We will have two interactions on this NPC.Click on the Element 0 field. Make sure its active checkbox is set to
true
; this ensures that this interaction is always evaluated. Note that the Condition and Response fields are waiting for a reference to be set.Drag-and-drop an instance of
condition_closerthanThresh
, and add it to the NPC.Set the
thresh
to15
units, thetrackObj...