Book Image

Creating E-Learning Games with Unity

By : David Horachek
Book Image

Creating E-Learning Games with Unity

By: David Horachek

Overview of this book

Table of Contents (17 chapters)
Creating E-Learning Games with Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 6. NPCs and Associated Technology

To increase the level of immersion in our e-learning game, we will want to increase the amount of user interaction scenarios. To do this, we will populate the game world with some non-player characters (otherwise known as NPCs) for the user to interact with. These are characters or actors in your game scene that the player can interact with during gameplay, but not control directly. You may find these referred to as AI Characters in other texts; however, these terms are synonymous.

In this chapter, we will build an NPC class to handle the choreography of these actors and their actions. To support the NPC system, we will develop a framework to define a smooth curve for the actors to travel on. We will also apply the FSM concepts from Chapter 4, Mission One – Future Proofing the Code, as we implement a data-driven behavior system; this will enable fast design and tweaking of NPC behavior inside the Unity Editor. Lastly, we will integrate these classes...