Game Development Reference
In-Depth Information
How it works...
This recipe follows the pattern we established in the Creating a trigger system recipe. In
the onTrigger method, we apply targetState , which will change the behavior and
actions of the AI. For example, it can change from PatrolState to AttackState . We
only supply the class type and not a whole instance of the class since the AI should already
have the state and it might be configured already. In this way, we tell the AI to simply
change the state if it is available. We also have a target field, in case the new state re-
quires that.
Search WWH ::




Custom Search