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

Adding NpcRacers to the mission


To make the race compelling and interesting, we will create two NPC racers to challenge the player. If it turns out well, we can build most of these with the technology we have already developed.

Each racer will need a spline to follow. Recall from the previous chapter that we developed a system for placing waypoints in the scene and using the SplineMgr script to generate a smooth curve for an NPC to follow. This will define the smooth path they traverse from start to finish. To implement the other racers in the level, carry out the following steps:

  1. Create an empty GameObject, and name it _splineDataA. Create a series of sphere game objects, and place them in a path from start to finish. Disable the mesh renderer of these objects, and then parent them all to _splineDataA.

  2. Create a second _splineData object with different path nodes so that the second racer will follow a similar but not identical route through the course. Name it _splineDataB.

  3. Parent these two...