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 another data condition


Just as we saw in Chapter 7, Mission Two – Testing a Player's Learning, when we created listData npcCondition which wrapped a list of GameObjects used to track racers in the race, we will need to create another type of wrapper in this mission; one for the initial score of the player. We can create this list with the following steps:

  1. Copy and paste listData.cs into the folder named Chapter9. Rename the copy floatData as shown in the following screenshot:

  2. Update the declaration in the script to match the new name of the file.

  3. Replace the list<GameObject> _listData variable with the following line of code:

    public float _floatData;

Congratulations! You have now created a second npcCondition data wrapper. An instance of this will be required by the logic of this level to compute the points scored.