O'Reilly logo

Creating E-Learning Games with Unity by David Horachek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Updating some systems

We introduce a new class, PlayerData, to track the current level and points accrued of the player. To make use of this new functionality, we need to update some systems by performing the following steps:

  1. Switch to the LEVEL1 scene. Double-click on the PlayerData script to begin editing it.
  2. Add a public int score and a public GameState level; note that in order to create an instance of the enumeration defined inside the GameMgr class, we need to prefix with GameMgr as shown in the following code:
    public class playerData : MonoBehaviour {
    public int score;
    public GameMgr eGameState;
  3. Add a public method called addScore(int dScore). This method will be used by the different systems (primarily MissionMgr), to add score to the player's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required