// Use this for initialization void Start () { trackSource = transform.parent.GetComponent<TrackController>().source; pulseController = GameObject.Find("GameController").GetComponent<PulseControllerScript>(); songController = GameObject.Find ("Tracks").GetComponent<SongController> (); initPos = transform.position.z; samplesSinceStart = trackSource.timeSamples; tempo = songController.tempo; timePerBeat = 60 / tempo; }
// Use this for initialization public void Init () { updateTime = 60 / tempo / 8f; Time.fixedDeltaTime = updateTime; float startTime = Time.fixedTime; float y = 10f / (2 * Mathf.Tan(Mathf.PI / 18f)); y = 26.35f; GameObject drumTrack = Instantiate (TrackPrefab, new Vector3 (0f, 0f, 0f), Quaternion.identity) as GameObject; drumTrack.transform.parent = transform; drumTrack.GetComponent<TrackController> ().SetTrackType (TrackController.TrackType.Drum); GameObject drum2Track = Instantiate (TrackPrefab, new Vector3 (0f, 0f, 0f), Quaternion.identity) as GameObject; drum2Track.transform.parent = transform; drum2Track.transform.RotateAround (new Vector3 (0f, y, 0f), Vector3.forward, 20); drum2Track.GetComponent<TrackController> ().SetTrackType (TrackController.TrackType.Drum2); GameObject bassTrack = Instantiate (TrackPrefab, new Vector3 (0f, 0f, 0f), Quaternion.identity) as GameObject; bassTrack.transform.parent = transform; bassTrack.transform.RotateAround (new Vector3 (0f, y, 0f), Vector3.forward, -20); bassTrack.GetComponent<TrackController> ().SetTrackType (TrackController.TrackType.Bass); GameObject synthTrack = Instantiate (TrackPrefab, new Vector3 (0f, 0f, 0f), Quaternion.identity) as GameObject; synthTrack.transform.parent = transform; synthTrack.transform.RotateAround (new Vector3 (0f, y, 0f), Vector3.forward, 40); synthTrack.GetComponent<TrackController> ().SetTrackType (TrackController.TrackType.Synth); GameObject padTrack = Instantiate (TrackPrefab, new Vector3 (0f, 0f, 0f), Quaternion.identity) as GameObject; padTrack.transform.parent = transform; padTrack.transform.RotateAround (new Vector3 (0f, y, 0f), Vector3.forward, -40); padTrack.GetComponent<TrackController> ().SetTrackType (TrackController.TrackType.Pad); float endTime = Time.fixedTime; delay = (int) ((endTime - startTime) / updateTime); pulseController = GameObject.Find ("GameController").GetComponent<PulseControllerScript> (); pulseController.enabled = true; audioTracks = GameObject.FindGameObjectsWithTag("AudioTrack"); foreach (GameObject audioTrack in audioTracks) { audioTrack.GetComponent<AudioSource> ().enabled = true; } //Debug.Log (tracks.Length); }
// Use this for initialization void Start () { gameController = GameObject.Find ("GameController").GetComponent<GameController> (); energy = (int)(maxEnergy * 0.75f); streakSource = GetComponent<AudioSource> (); PulseController = GameObject.Find("GameController").GetComponent<PulseControllerScript>(); buttonTransforms [0] = GameObject.Find ("XIndicator").GetComponent<Transform> (); buttonLights [0] = GameObject.Find ("XIndicator").GetComponent<Light> (); buttonTransforms [1] = GameObject.Find ("YIndicator").GetComponent<Transform> (); buttonLights [1] = GameObject.Find ("YIndicator").GetComponent<Light> (); buttonTransforms [2] = GameObject.Find ("BIndicator").GetComponent<Transform> (); buttonLights [2] = GameObject.Find ("BIndicator").GetComponent<Light> (); streakBar [0] = GameObject.Find ("Dot1").GetComponent<MeshRenderer>(); streakBar [1] = GameObject.Find ("Dot2").GetComponent<MeshRenderer>(); streakBar [2] = GameObject.Find ("Dot3").GetComponent<MeshRenderer>(); streakBar [3] = GameObject.Find ("Dot4").GetComponent<MeshRenderer>(); streakBar [4] = GameObject.Find ("Dot5").GetComponent<MeshRenderer>(); streakBar [5] = GameObject.Find ("Dot6").GetComponent<MeshRenderer>(); streakBar [6] = GameObject.Find ("Dot7").GetComponent<MeshRenderer>(); energyBar [0] = GameObject.Find ("Bar1").GetComponent<MeshRenderer> (); energyBar [1] = GameObject.Find ("Bar2").GetComponent<MeshRenderer> (); energyBar [2] = GameObject.Find ("Bar3").GetComponent<MeshRenderer> (); energyBar [3] = GameObject.Find ("Bar4").GetComponent<MeshRenderer> (); energyBar [4] = GameObject.Find ("Bar5").GetComponent<MeshRenderer> (); energyBar [5] = GameObject.Find ("Bar6").GetComponent<MeshRenderer> (); energyBar [6] = GameObject.Find ("Bar7").GetComponent<MeshRenderer> (); energyBar [7] = GameObject.Find ("Bar8").GetComponent<MeshRenderer> (); multiplierBar[0] = GameObject.Find ("Mult1").GetComponent<MeshRenderer> (); multiplierBar[1] = GameObject.Find ("Mult2").GetComponent<MeshRenderer> (); multiplierBar[2] = GameObject.Find ("Mult3").GetComponent<MeshRenderer> (); multiplierBar[3] = GameObject.Find ("Mult4").GetComponent<MeshRenderer> (); }