O'Reilly logo

Mastering Unity 5.x by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Zombies and the Typer class

We've now configured the zombie to display the selected word, and also to add text stylizations based on player input. However, we still haven't linked player input through the Typer class (coded in the previous chapter) with the zombie NPC. Let's do this now by adding a new function to the EnemyAI class, namely UpdateTypedWord. This function compares the typed word with the associated word to determine the extent of a match. The purpose is twofold, firstly, to generate the MatchedWord string, for highlighting the typed portion of the Associated Word; and secondly, to fire a word matched event (OnTypingMatched), which causes the zombie to die. Consider the following code:

 //------------------------------------ public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required