public void StartGame() { if (GameStarted) { return; } GameStarted = true; VibrationManager = GetComponent <ControllerVibrationManager>(); RobotArms = new GameObject[6]; //NoteEndStartingPosition = new Vector3[6]; for (int i = 0; i < RobotArms.Length; i++) { RobotArms[i] = GameObject.Instantiate(RobotArmPrefab, transform.position, transform.rotation * Quaternion.Euler(i * 60, 0, 0)); //RobotArms[i].GetComponent<PunchPadHitDetection>().noteMgr = this; RobotArms[i].GetComponent <TestArmScr>().ArmIndex = i; //NoteEndTarget[i] = RobotArms[i].GetComponentInChildren<NoteMeshScr>().gameObject.transform; } SimpleJSON.JSONNode data = SimpleJSON.JSON.Parse(SongKeyframes.text); Debug.Log("Tempo " + data["tempo"]); SongTempo = data["tempo"]; Notes = new Note[data["tracks"].Count]; Debug.Log("Tracks Count " + data["tracks"].Count); for (int i = 0; i < data["tracks"].Count; i++) { Notes[i] = new Note(); //Notes[i].NoteObj = GameObject.Instantiate(NotePrefab, Vector3.zero, Quaternion.identity); Notes[i].NoteObj.SetActive(false); Notes[i].pad = data["tracks"][i]["p"]; Notes[i].time = data["tracks"][i]["t"]; //Notes[i].EndTarget = NoteEndTarget[Notes[i].pad]; Debug.Log("note pad " + i + ": " + Notes[i].pad); Debug.Log("note time " + i + ": " + Notes[i].time); } GetComponent <AudioSource>().clip = SongClip; GetComponent <AudioSource>().Play(); //just didn't want to hear this every time I hit play ScoreText.text = "Score: " + Score.ToString(); }
// Use this for initialization void Start() { _rigidbody2D = GetComponent <Rigidbody2D>(); _oneWayController = GetComponent <OneWayController>(); if (team == Team.red) { playerModel.localScale = new Vector3(-playerModel.localScale.x, playerModel.localScale.y, playerModel.localScale.z); } if (team == Team.blue) { deathParticle = deathParticles[0]; } else { deathParticle = deathParticles[1]; } vibrationManager = GameManager.instance.gameObject.GetComponent <ControllerVibrationManager>(); }