bool showGUI = false; //!< flag to hold whether or not to show the gui above the game /** * Use this for initialization. * For this script the string representations of variable values are populated. */ void Start() { debugConfig = gameObject.GetComponent <EsophagusDebugConfig>(); // find the reference to the debug config foodSpawnInterval = "" + debugConfig.foodSpawnInterval; // create the string for the foodSpawnInterval variable waveDelay = "" + debugConfig.waveDelay; // create the string for the waveDelay variable waveTime = "" + debugConfig.waveTime; // create the string for the waveTime variable foodSpeed = "" + debugConfig.foodSpeed; // create the string for the foodSpeed variable oxygenDeplete = "" + debugConfig.oxygenDeplete; // create the string for the oxygenDeplete variable oxygenGain = "" + debugConfig.oxygenGain; // create the string for the oxygenGain variable debugActive = debugConfig.debugActive; // create the string for the debugActive variable }
EsophagusDebugConfig debugConfig; //!< to hold a reference to the mouth debug config /** * Use this for initialization * Finds references and initializes values. */ void Start() { GameObject flaps = GameObject.Find("Flaps"); // find the reference to the flaps flap = flaps.GetComponent <openFlap>(); // find the script on the flaps quaternion = transform.rotation; quaternion.Duration = .5f; debugConfig = GameObject.Find("Debugger").GetComponent <EsophagusDebugConfig>(); // find the reference to the debugger b = GameObject.Find("flap1").GetComponent <BoxCollider> (); }
/** * Use this for initialization * Find references, initialize variables */ void Start() { percent = 1f; // the oxygen bar should start off at 100% previousPercent = percent; GameObject flaps = GameObject.Find("Flaps"); // find the flaps reference flap = flaps.GetComponent <openFlap>(); // get the script from the flaps GameObject debugger = GameObject.Find("Debugger"); // find a reference to the debugger config = debugger.GetComponent <EsophagusDebugConfig>(); // get the script from the debug config }
public bool end = false; //!< flag to indicate whether we are at the end of the script /** * Use this for initialization * Verifies the level was loaded correctly and if not reloads it. * Starts loading from script/debugger. */ void Start() { level = null; // set the MouthLoadLevelCounter to null to begin with // find the reference to the mouth debugger debugConfig = GameObject.Find("Debugger").GetComponent <EsophagusDebugConfig>(); if (debugConfig == null) // if we are starting the game directly we need to add debugger { debugConfig = gameObject.AddComponent <EsophagusDebugConfig>() as EsophagusDebugConfig; } // find the background chooser GameObject chooseBackground = GameObject.Find("MouthChooseBackground"); if (chooseBackground != null) // if we did find the background chooser, get the level from it { level = chooseBackground.GetComponent <MouthLoadLevelCounter>(); } else // in this case we started the game load game properly { // this will cause the mouth game to be properly loaded from level 1 PlayerPrefs.SetInt("DesiredMouthLevel", 1); PlayerPrefs.Save(); Application.LoadLevel("LoadLevelMouth"); } // we also need to find the references to the flaps GameObject flaps = GameObject.Find("Flaps"); // find the reference to the flaps flap = flaps.GetComponent <openFlap>(); // get the openFlap script from the flaps if (level != null) // guard for if level was null since this will still execute before the reloading from level 1 { // finally load the script loadScript = new LoadScriptMouth(); // create a new script loader waves = loadScript.loadMouthLevel(level.getLevel()); // load the proper script to the level and store data // begin parsing the data currentWave = 0; // reset the current wave counter to 0 waveDelay = waves[0].startDelay; // get the waveDelay for the current wave waveTime = waves[0].runTime; // get the waveTime for the current wave SpawnInterval = waves[0].foodSpawnInterval; // get the spawnInterval for the current wave speed = waves[0].foodSpeed; // get the foodSpped for the current wave m_TimeSinceLastSpawn = 0f; // reset the time since last spawn to 0 } }