Game Development Reference
In-Depth Information
5. If there is one, we take the score value from PlayerData and assign it to
the text field of the textbox. Note that we have to use the C# helper function
.ToString() to convert the integer score value to a string that the GUIText
can use as shown in the following code:
if (pd)
{
int score = pd.GetScore();
this.gameObject.GetComponent<GUIText>().text
= score.ToString();
}
Congratulations! Now, if we switch back to the MAIN scene and playtest, note that
once you have collected five flags, the score updates to 500. Return the flags to the
monument for another 500 points!
Search WWH ::




Custom Search