// Use this for initialization void Start() { canQuitSettings = GameObject.FindGameObjectWithTag("GameController").GetComponent<SettingsExitBuffer>(); pauseOverlay = GameObject.FindGameObjectWithTag("Pause Overlay").GetComponent<Canvas>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>(); settingsOverlay = GameObject.FindGameObjectWithTag("Settings Screen").GetComponent<Canvas>(); bombTimer = GetComponentInChildren<BombCountdownController>(); audio_effects = GetComponents<AudioSource>()[7]; AudioListener.pause = false; }
// Use this for initialization void Awake() { Cursor.lockState = CursorLockMode.Confined; audio_bullet = GetComponents<AudioSource>()[0]; //0: bullets, 1: engines, 2: shield, 3: impacts, 4: other audio_engineHum = GetComponents<AudioSource>()[1]; audio_engineHum.enabled = true; audio_engineHum.Play(); audio_accellerators = GetComponents<AudioSource>()[2]; audio_thrusters = GetComponents<AudioSource>()[3]; audio_hullHit = GetComponents<AudioSource>()[4]; audio_wallImpact = GetComponents<AudioSource>()[5]; audio_effects = GetComponents<AudioSource>()[6]; audio_bomb = GetComponents<AudioSource>()[7]; audio_accellerators_max_vol = audio_accellerators.volume; audio_thrusters_max_vol = audio_thrusters.volume; Time.timeScale = 1; // The time scale must be reset upon loading from the main menu rb = GetComponent<Rigidbody>(); originalColor = mesh.GetComponent<Renderer>().material.color; curPowerUp = powerUpList[0]; shield = GetComponentInChildren<ShieldController>(); bomb = GetComponentInChildren<BombController> (); maxHullIntegrity = currHullIntegrity = 5; armorGauge = gameObject.GetComponentInChildren<ArmorController>(); bombTimer = gameObject.GetComponentInChildren<BombCountdownController>(); deathEndingTimer = 0.0f; sceneTransition = GameObject.FindGameObjectWithTag("Screen Transition").GetComponent<CanvasGroup>(); transitionRate = 3; if (tutorialMode) { //Debug.Log("tutorial mode"); currHullIntegrity = 0; } Transform[] temp = bulletSpawns.GetComponentsInChildren<Transform>(); bulletSpawnLocations = new Transform[temp.Length - 1]; bulletSpawnLocIndex = 0; for(int i = 0; i < temp.Length; ++i) { if(temp[i].gameObject.GetInstanceID() != bulletSpawns.GetInstanceID()) { bulletSpawnLocations[bulletSpawnLocIndex] = temp[i]; ++bulletSpawnLocIndex; } } if (GameObject.Find("GameController") == null) { Instantiate(gameController); } gameController = GameObject.FindGameObjectWithTag("GameController"); im = gameController.GetComponent<InputManager>(); mainThrusterLeft.Play (); mainThrusterRight.Play (); }