Creating a WordList class

Now we must build a class to process the word list asset. This involves a class that can open and read the word list itself, select a word at random from the list, and compare two words for a match. The latter is needed to compare the typed word with the selected word from the dictionary. To start with, a new Singleton called classWordList.cs should be created. The basic skeleton is as follows:

For more information on Singleton objects, refer to Chapter 3, Player Controls - Movement. In addition, you can view the Unity online Wiki at http://wiki.unity3d.com/index.php/Singleton.
using UnityEngine;using System.Collections;using System.Collections.Generic;//------------------------------------public class WordList : ...

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.