Game Development Reference
In-Depth Information
You are probably thinking that the text color for the failure message would look better if it was a less
cheery color. It turns out, you can override the text color fairly easily. For that, you will require a flag
to tell it when it should override.
1.
Add the following variable to the EndGameGUI script:
bool overrideColor = false; // flag for message colors
In the TriggerMessage function, above the showEndGUI line, you could add
if(finishedMessage == "Garden Overrun") overrideColor = true;
else overrideColor = false;
Instead, because the variable is a Boolean, you can evaluate the same expression and assign its
result directly to a variable. Take a minute to work this one out in your head if it is confusing.
In the TriggerMessage function, above the showEndGUI line, add
2.
overrideColor = (finishedMessage == "Garden Overrun");
In the OnGUI function, at the top of the if (showEndGUI) clause, add
3.
if (overrideColor) GUI.color = new Color(0.8f,0,0); // a dark red
Underneath the GUI.Label line, add
4.
GUI.color = Color.white; // return it to white, a pre-defined color
Several colors are predefined in the Color class, such as black, white, red, blue, and a few others.
A custom Color, if you remember, uses unit values rather than the more familiar 256 value for each
color channel.
5.
Save the script
6.
Click Play, and wait for the battery to run out.
This time, the text color is suitably gloomy.
7.
Select the Game Manager, and set the Score Keeper's Stop Pop X
parameter to 1 .
8.
Select the Battery Life, and set the Battery Full parameter back to 70 .
9.
Save the scene.
Starting the Game
If working on the start of the game at the end of the project seems more than a bit backwards to
you, consider the following issues. Game play is the most important part of the game. Until you
have a game at least partially fleshed out, there's no point in spending a lot of time on a start menu.
The game play, theme, or artistic style could change dramatically as ideas are tested and refined.
The game itself may even be abandoned for any number of reasons.
 
Search WWH ::




Custom Search