Game Development Reference
In-Depth Information
There will be times when we would like to inspect which animation is currently playing
from outside the class. For that, we implement a simple method which returns the name of
the currently playing animation:
Now that we've taken a look at all the supporting methods of the class, let's inspect what
the most important of them looks like—the Animator::Update() method:
The preceding code should ring a bell or two—it is quite similar to what we did for the
animation in the previous section. It starts off with a check for m_CurrentAnimation .
Since that value can be nullptr , we do not need to do anything in that case. Next, we
add the delta time to the local time buffer. We scale that time by the animation duration to
get scaledTime , which is used to figure out which frame to show. As we did in the pre-
Search WWH ::

Custom Search