The Typer object

The WordList class supports the import and tokenization of a dictionary, generating an array of words on a line-by-line basis. The GetRandomWord function returns a randomly selected word from the dictionary, and the CompareWord function determines whether a typed word matches the chosen one entirely, partially, or not at all. Having now created this class, we begin work on the Typer class, which actually accepts typed input from the keyboard, processes that input, and displays UI complements for player feedback. Let's start by creating an object hierarchy. Create a new, empty object at the scene origin to act as the topmost node for Typer. Name the object Typer and then create a Canvas object as a child. The canvas contains ...

Get Mastering Unity 2017 Game Development with C# - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.