Warfront Infinite Dev Blog #21: The First Enemy (Animations)
This week me and my artist were working hard on the new alien model and its animations. My job was to implement the animated models into the game engine, manage transitions between different states and rewrite the enemy controller script. Since I haven’t worked on skeletal animations in unity yet, it was a good learning experience and I found out that unity has this Animator component which handles transitions between animations and it is really easy to use. All I had to do was use Animator editor to create few different states (for walking, dying, getting hurt and attacking) and draw some lines between states to mark transitions.
Then you can click on each of the connecting lines to edit the transition between those states and it will bring up this window:
Here you can edit how fast the transitions occurs, when does it occur and more.
To control the animations using the C# script all you have to do is to use GetComponent<Animator>() and then call its .Play(<animationName>) method. It will automatically do all the transitions which you created in the Animator tab.
This is how the animations look in game:
As you can see I added some glowing which I thought would look cool.
There’s still 5 more alien enemies left to do and after that we’ll be working on the environment, adding buildings, new textures and overall changing the look of the levels.