Book Image

Mastering Unity 5.x

By : Alan Thorn
Book Image

Mastering Unity 5.x

By: Alan Thorn

Overview of this book

Mastering Unity 5.x is for developers wishing to optimize the features of Unity 5.x. With an in-depth focus on a practical project, learn all about Unity architecture and impressive animation techniques. With this book, produce fun games with confidence.
Table of Contents (16 chapters)
Mastering Unity 5.x
Credits
About the Author
Acknowledgment
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

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...