More kinds of cakes

Of course, the first challenge is to add different kinds of cakes, or at least, different collectables. In the first place, you can still use the CollectableCake script and change their values. But remember to create a prefab, and add all the proper colliders. For instance, in the package you can find a purple diamond, that is a good start to make objects with more values.

However, when you've got different cakes and/or objects with different values, you don't want to calculate the sum of their values by hand. In this case, we can set the pointsToNextLevel variable in the Start() function of the UI_Score script.

Here is a possible example:

// Use this for initialization
void Start () {
//Get a reference to the Text component
uiText = GetComponent<Text>();
//Get the sum of all the cake values around the level
foreach(CollectableCake cake in FindObjectsOfType<CollectableCake>()) {
pointsToNextLevel += cake.cakeValue;
}
}

Other suggestions include creating a second score system similar to the first one for another kind of collectible or adding some power-ups. So when the player collects this specific object, the script increases the speed in the PlayerController. But these are just a few examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset