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 here 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 the Typer. Name the object Typer
and then create a Canvas
object as a child. The canvas contains all objects for the associated UI.
Creating a Typer object
As with previous canvas components, we'll configure it to support multiple resolutions with a scaling technique. Set the UI Scale Mode to Scale With Screen Size and specify a Reference...