// Use this for initialization void Start() { // Fetch system object if (!GameObject.Find("rocketGameSystem")) { system = GameObject.Instantiate(systemPrefab).GetComponent <RocketGameSystem> (); //system.init (); } else { system = GameObject.Find("rocketGameSystem").GetComponent <RocketGameSystem> (); } GO = GetComponent <RocketGameGameOverScript> (); countdown = GetComponent <RocketGameCountdown> (); // Get starting level currentLevel = system.getStartingLevel(); // Get HUD objects fuelMeter = GameObject.Find("UICanvas/fuelMeter/currentFuel").GetComponent <Transform> (); damagedFuelMeter = GameObject.Find("UICanvas/fuelMeter/damagedFuel").GetComponent <Transform> (); altitudeMeter = GameObject.Find("UICanvas/altitudeMeter/currentAltitude").GetComponent <Transform> (); altitudeMeterText = GameObject.Find("UICanvas/altitudeMeter/textObjects/text/altitude").GetComponent <Text> (); speedoMeter = GameObject.Find("UICanvas/altitudeMeter/textObjects/arrow").GetComponent <Transform> (); fuelMeterFG = GameObject.Find("UICanvas/fuelMeter/fg_graphic").GetComponent <SpriteRenderer> (); fullAltitudeMeter = GameObject.Find("UICanvas/altitudeMeter/fullAltitude").GetComponent <SpriteRenderer> (); bg = GameObject.Find("BG_Canvas/BG").GetComponent <Image> (); unpause(); if (system.isEndless()) { enableEndlessMode(); } //Init spawnable list spawnedObjects = new List <ObjectScript> (); spawnedBackgroundObjects = new List <ObjectScript> (); UICanvas = GameObject.Find("UICanvas").GetComponent <Transform> (); MainCanvas = GameObject.Find("MainCanvas").GetComponent <Transform> (); bgCanvas = GameObject.Find("BG_Canvas").GetComponent <Transform> (); // START THE GAME gameStart(); }
// Use this for initialization void Start() { timer = 0f; // Fetch system object if (!GameObject.Find("rocketGameSystem")) { system = GameObject.Instantiate(systemPrefab).GetComponent <RocketGameSystem> (); //system.init (); } else { system = GameObject.Find("rocketGameSystem").GetComponent <RocketGameSystem> (); } Text t = GameObject.Find("MainCanvas/endless/highscorebox/text/highscore").GetComponent <Text> (); t.text = system.getHighscore() + "m"; player = GameObject.Find("MainCanvas/playerObject_levelSelect").GetComponent <RocketGameLevelSelectPlayerObject> (); setButtonEventListeners(); }