void Start () {
Component[] particleSystemComponents = GetComponentsInChildren<ParticleSystem>();
Component[] audioSourceComponents = GetComponentsInChildren<AudioSource>();
engineList = new ArrayList();
exhaustList = new ArrayList();
audioSourceList = new ArrayList();
foreach (ParticleSystem child in particleSystemComponents){
if (child.name.Contains("Engine")){
engineList.Add(child);
} else if (child.name.Contains("Exhaust")){
exhaustList.Add(child);
}
}
foreach (AudioSource child in audioSourceComponents){
if (child.transform.parent == transform){
audioSourceList.Add(child);
child.GetComponent<AudioSource>().volume = 0;
}
}
animator = GetComponent<Animator>();
myRigidbody = GetComponent<Rigidbody>();
gearDown = false;
SceneState.OnStateChange += OnStateChange;
CameraState.OnStateChange += OnStateChange;
}
//rotational : x ws y qe z ad