// Use this for initialization. void Start() { driver = transform.GetComponentInParent <Driver> (); floorTracker = transform.GetComponentInParent <FloorTracker> (); uiSource = GetComponent <AudioSource> (); engineSource = transform.parent.GetComponent <AudioSource> (); targetSound = transform.FindChild("Target Sound").gameObject; targetSource = targetSound.GetComponent <AudioSource> (); ChangeTarget(0, false); }
// Use this for initialization. void Start() { if (hazards == null) { hazards = new GameObject[0]; } hazardCounters = new int[hazards.Length]; for (int i = 0; i < hazards.Length; i++) { float distance = Vector3.Distance(hazards[i].transform.position, transform.parent.position); hazardCounters[i] = 10 + (int)(distance * 9 / 10); } controller = GetComponentInParent <AudioController> (); source = GetComponent <AudioSource> (); tracker = GetComponentInParent <FloorTracker> (); }
// Use this for initialization. void Start() { tracker = GetComponent <FloorTracker> (); controller = GetComponentInChildren <AudioController> (); }