- Home /
Keeping track of variables?
Hello. I am using a toolbars to define the options in my game (mode, difficulty, etc.) This scene is going to have multiple toolbars, would it be possible to record the specific combination of elements chosen(so it would say something like "Mode==1", "Difficulty==2", "Character==4")? So I could have a favorites menu and different versions of my game over script for each combination? How would I do that? Thanks
Here is part of the toolbar display script (it's name is "Arcade")
var gSkin : GUISkin; static var ModeInt :int = 0;
function OnGUI() { GUI.skin = gSkin;
ModeInt = GUI.Toolbar (Rect (240, 270, 500, 50), ModeInt, ["Survival", "Collector", "Timed", "Hotspot", "Evasion"]); }
and here is the script where I am going to store the options function Awake () {DontDestroyOnLoad (transform.gameObject);}
function Update ()
{
if (Arcade.ModeInt ==0) {//survival mode}
if (Arcade.ModeInt ==1) {//Timed mode}
if (Arcade.ModeInt ==2) {//Collector mode}
if (Arcade.ModeInt ==3) {}
if (Arcade.ModeInt ==4) {}
}
Try using enums: enum modeTypes {survival , timed, collector}; var present$$anonymous$$ode: modeTypes = modeTypes.survival;
Then you can use the enums normally in your if statements without having to remember numbers:
if (present$$anonymous$$ode == modeTypes.survival) {...
Your answer

Follow this Question
Related Questions
Help with GUIText health bar please 1 Answer
Inventory Cursor Location 1 Answer
How to make a Score GUI. 0 Answers