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

Implementing the LevelLogicObj GameObject


When instantiated, the LevelLogicObj object will be detected as soon as the player and racers enter the LevellogicObj's trigger volume. When three racers have crossed the finish line, it will determine if the player has met the objectives of the race or not, and it will enable either the pass or fail retry pop up. In order to implement the LevelLogicObj object, we need to perform the following steps:

  1. Create a cube game object named LevelLogicObj. Scale, orient, and position it so that it surrounds the finish line in the level as shown in the following screenshot:

  2. Make sure it has a Box Collider component and that the Is Trigger checkbox is checked as shown in the following screenshot:

  3. We want to use the DecisionMgr class to track the progress of the racers, which means we need to add an instance of npcScript to this object.

  4. Don't worry about the fact that the LevelLogicObj object is not specifically an NPC; if an existing tool is appropriate, don't reinvent...