void Start() { inputs = GetComponent <SCC_Inputs> (); wheels = GetComponentsInChildren <SCC_Wheel> (); if (!inputs) { Debug.LogError("SCC_Inputs couldn't found on this gameobject!"); enabled = false; return; } if (wheelParticlePrefab) { for (int i = 0; i < wheels.Length; i++) { ParticleSystem particle = (ParticleSystem)Instantiate(wheelParticlePrefab, wheels [i].transform.position, wheels [i].transform.rotation, wheels [i].transform); createdParticles.Add(particle.GetComponent <ParticleSystem> ()); } wheelEmissions = new ParticleSystem.EmissionModule[createdParticles.Count]; for (int i = 0; i < createdParticles.Count; i++) { wheelEmissions[i] = createdParticles[i].emission; } } if (exhaustParticles != null && exhaustParticles.Length >= 1) { exhaustEmissions = new ParticleSystem.EmissionModule[exhaustParticles.Length]; for (int i = 0; i < exhaustParticles.Length; i++) { exhaustEmissions [i] = exhaustParticles [i].emission; } } }
void Start() { drivetrain = GetComponent <SCC_Drivetrain> (); inputs = GetComponent <SCC_Inputs> (); car = GetComponent <Transport>(); GameObject engineOnGO = new GameObject("Engine On AudioSource"); engineOnGO.transform.SetParent(transform, false); engineOnSource = engineOnGO.AddComponent <AudioSource> (); engineOnSource.clip = engineOn; engineOnSource.loop = true; engineOnSource.spatialBlend = 1f; engineOnSource.Play(); GameObject engineOffGO = new GameObject("Engine Off AudioSource"); engineOffGO.transform.SetParent(transform, false); engineOffSource = engineOffGO.AddComponent <AudioSource> (); engineOffSource.clip = engineOff; engineOffSource.loop = true; engineOffSource.spatialBlend = 1f; engineOffSource.Play(); }
void Start() { inputs = GetComponent <SCC_Inputs> (); }