Progressing with the Typer class
The Typer object (the root object) will be associated with a new class, defining its functionality. This class (the Typer
class) will accept keyboard input and link that to a combat mechanic. We haven't yet developed any enemies to fight (like zombies), but this will be dealt with in forthcoming chapters. Consequently, we'll have reason to return to the Typer class later. As it stands, we can still link player input to important functionality already in place, such as UI animations and sound effects too. Let's begin with a new, empty class, as follows:
using System.Collections; public class Typer: MonoBehaviour { }
The first step in developing the Typer
class is to build an extensible event framework. Events
are critically important for the Typer
because it must listen for a keypress (Events
) and then relay those to other processes, which should respond as needed. There are multiple solutions for developing an integrated event...