private void Start() { m_TruckController = GetComponent <VehicleController2017> (); gearSource = gameObject.AddComponent <AudioSource> (); gearSource.loop = false; gearSource.playOnAwake = false; gearSource.spatialBlend = 0; gearSource.volume = gearVolume; audioSource = GetComponent <AudioSource>(); audioSource.clip = EngineSound; audioSource.loop = true; audioSource.Play(); if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.Contains("Garage") || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == garageSceneName) { audioSource.Stop(); this.enabled = false; } }
IEnumerator Start() { currentCamera = GetComponent <Camera> (); yield return(new WaitForEndOfFrame()); // Find player car by tag after game started target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); carRigidBody = target.GetComponent <Rigidbody> (); vehicleController = target.GetComponent <VehicleController2017> (); }
void Start() { if (SceneManager.GetActiveScene().name.Contains("Garage") || SceneManager.GetActiveScene().name.Contains("Menu")) { return; } car = GetComponent <VehicleController2017> (); // Set car motor power based on upgrade value on upgrade menu car.enginePower = enginePower[PlayerPrefs.GetInt("Engine" + PlayerPrefs.GetInt("CarID").ToString())]; car.maxSpeed = maxSpeed[PlayerPrefs.GetInt("Speed" + PlayerPrefs.GetInt("CarID").ToString())]; car.brakePower = brakeUpgrade[PlayerPrefs.GetInt("Brake" + PlayerPrefs.GetInt("CarID").ToString())]; }
IEnumerator Start() { if (autoSwitch) { #if UNITY_EDITOR || UNITY_WEBGL controllType = InputType.Keyboard; GetComponent <PauseMen>().mobileControlls.SetActive(false); #else controllType = InputType.Mobile; #endif } hornComponent = GetComponent <VehicleHorn> (); camManager = GetComponent <CameraManager> (); if (PlayerPrefs.GetInt("ControlType") == 0) { sWheel.SetActive(true); arrowKeys.SetActive(false); sWheelControl = true; } if (PlayerPrefs.GetInt("ControlType") == 1) { sWheel.SetActive(false); arrowKeys.SetActive(true); } if (PlayerPrefs.GetInt("ControlType") == 3) { sWheel.SetActive(false); arrowKeys.SetActive(false); accelInput = true; } yield return(new WaitForEndOfFrame()); controller = GameObject.FindObjectOfType <VehicleController2017> (); }
void Start() { manager = GameObject.FindObjectOfType <DriftManager> (); vehicleController = GetComponentInParent <VehicleController2017> (); vehicleAudio = GetComponentInParent <VehicleAudio2017> (); }