Game Development Reference
In-Depth Information
Here, when we start the action, we find all the
NavigationTargetRig
objects and
store them in the
coverPoints
array. Then, we go through each target and find the
one closest to the enemy. Once we have the closest target, we store it in
hideTar-
get
and start moving to it.
As an addition to this, we can have the enemy start attacking again after hiding. Add
the following line right before
ActionResult.SUCCESS
is returned:
ai.WorkingMemory.SetItem("isHiding", false);
This just updates the memory to set the hiding value to false and the attack will re-
start. This is a simple extension and the attack can be easily extended to better at-
tack behaviors.