void Update() { if (!this.startedPlaying) { this.startedPlaying = true; this.audio.Play(); } int hit = 0; if (Input.GetKey(KeyCode.Escape)) { SceneChange scenechange = FindObjectOfType <SceneChange>(); scenechange.FadeToLevel("Title"); } if (Input.GetKeyDown(KeyCode.Joystick1Button0) || Input.GetKeyDown(KeyCode.Q)) { if (this.redPickup.PlayNote() > 0) { this.Hit(); } } if (Input.GetKeyDown(KeyCode.Joystick1Button1) || Input.GetKeyDown(KeyCode.W)) { if (this.greenPickup.PlayNote() > 0) { this.Hit(); } } if (Input.GetKeyDown(KeyCode.Joystick1Button2) || Input.GetKeyDown(KeyCode.E)) { if (this.bluePickup.PlayNote() > 0) { this.Hit(); } } if (Input.GetKeyDown(KeyCode.Joystick1Button3) || Input.GetKeyDown(KeyCode.R)) { if (this.yellowPickup.PlayNote() > 0) { this.Hit(); } } }
private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.tag == "Note") { for (int i = 0; i < this.notes.Count; i++) { if (this.notes[i] == collision.gameObject) { this.notes.RemoveAt(i); i--; } } } if (collision.gameObject.tag == "EndNote") { SceneChange sceneChange = FindObjectOfType <SceneChange>(); sceneChange.FadeToLevel("Score"); } }