Game Development Reference
In-Depth Information
The Idle state, as implemented so far, loops infinitely and never changes to another
state unless the player is seen. However, the Idle state should only be temporary;
the idle animation should play once and then notify us of its completion. To achieve
this playback notification, we can use Animation Events. To configure this, select
the Constructor character mesh in the Project panel and open the Animation tab to
examine the idle animation in the Object Inspector. From here, open the Events tab,
as shown in the following screenshot:
Expanding the Events tab in the Object Inspector
Then, double-click on the animation timeline at time 1 (at the end) to insert a
function call at that time. This sends a message to the enemy object when the
animation completes, as shown in the following screenshot. For this purpose,
I've coded a method OnIdleAnimCompleted inside the AI_Enemy class:
 
Search WWH ::




Custom Search