public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) //If the key is being pressed { switch (key) { case PianoDriver.KeyNote.DO: GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().ChangeState(StageManager.State.MenuGame); Destroy(this.gameObject); break; case PianoDriver.KeyNote.SOL: if (GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().AudioNotes) { GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().AudioNotes = false; Audio_info.text = "\nU\nN\nM\nU\nT\nE\n\nN\nO\nT\nE\nS"; } else { GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().AudioNotes = true; Audio_info.text = "M\nU\nT\nE\n\nN\nO\nT\nE\nS"; } break; case PianoDriver.KeyNote.DO2: JsonManagerScore.InitLvlJSON(); GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().ChangeState(StageManager.State.MenuGame); Destroy(this.gameObject); break; } } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) { initGame(); } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) //If the key is being pressed { switch (key) { //LEFT case PianoDriver.KeyNote.DO: this.left(); break; //PLAY case PianoDriver.KeyNote.MI: this.playLevel(); Destroy(this.gameObject); break; //RIGHT case PianoDriver.KeyNote.SOL: this.right(); break; //EXIT case PianoDriver.KeyNote.DO2: GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().ChangeState(StageManager.State.MenuGame); Destroy(this.gameObject); break; } } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (key == KeyNote) { ActionRecieved(action); } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) //If the key is being pressed { switch (key) { case PianoDriver.KeyNote.DO: lvl_aux = Instantiate(MenuLevels); lvl_aux.name = lvl_aux.transform.name.Replace("(Clone)", ""); lvl_aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position; lvl_aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation; GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().NextState(); break; case PianoDriver.KeyNote.SOL: lvl_aux = Instantiate(MenuImport); lvl_aux.name = lvl_aux.transform.name.Replace("(Clone)", ""); lvl_aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position; lvl_aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation; GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().NextState(); break; case PianoDriver.KeyNote.DO2: lvl_aux = Instantiate(MenuSettings); lvl_aux.name = lvl_aux.transform.name.Replace("(Clone)", ""); lvl_aux.transform.position = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().position; lvl_aux.transform.rotation = GameObject.FindGameObjectWithTag("Piano").GetComponent <Transform>().rotation; GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().NextState(); break; } } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) { Destroy(this.gameObject); } }
private Vector3 positionNote(PianoDriver.KeyNote target) { Transform aux = GameObject.FindGameObjectWithTag("Triggers").transform.Find(target.ToString()); Vector3 target_position = aux.localPosition.x * this.GetComponent <Transform>().right.normalized; return(target_position); }
public NoteMusicSheet(int measure, int beat, int partBeat, PianoDriver.KeyNote note, int finger) { Measure = measure; Beat = beat; PartBeat = partBeat; Note = note; Finger = finger; }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { try { //Debug.Log(key + " " + action); GameObject aux = (GameObject)keys[key]; aux.GetComponent <PianoKey>().ActionRecieved(action); } catch (Exception e) { } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (action == true) //If the key is being pressed { switch (key) { case PianoDriver.KeyNote.SOL: this.transform.parent.GetComponent <StateImportManager>().NextState(); Destroy(this.gameObject); break; } } }
public void PianoActionRecieved(PianoDriver.KeyNote key, bool action) { if (this.isActiveAndEnabled) { if (key == PianoDriver.KeyNote.SOL && action == false) { GameObject aux = Instantiate(piano); aux.name = aux.transform.name.Replace("(Clone)", ""); aux.transform.position = this.transform.position; aux.transform.rotation = this.transform.rotation; GameObject.FindGameObjectWithTag("AppManager").GetComponent <StageManager>().NextState(); } } }
public void Initialize(PianoDriver.KeyNote target, float initPosition, float speed, int finger) { this.transform.position += new Vector3(0, initPosition, 0); this.transform.position += positionNote(target); this.transform.rotation = Quaternion.LookRotation(this.transform.forward.normalized); rb.velocity = new Vector3(0, speed, 0); Target = target; this.speed = speed; this.finger = finger; if (finger > 0 && finger < 6) { infoFinger1.text = finger.ToString(); infoFinger2.text = finger.ToString(); } initialized = true; }
private void parseXML(XDocument _xml) { List <NoteMusicSheet> MusicSheetNotes = new List <NoteMusicSheet>(); IEnumerable <XElement> _dict = _xml.Element("score-partwise").Element("part").Elements("measure"); //SetUp MusicSheet BeatsPerMeasure = Int32.Parse(_xml.Element("score-partwise").Element("part").Element("measure").Element("attributes").Element("time").Element("beats").Value); Tempo = float.Parse(_xml.Element("score-partwise").Element("part").Element("measure").Element("direction").Element("direction-type").Element("metronome").Element("per-minute").Value); //Read Notes foreach (XElement measure in _dict) { TotalMeasures++; actual_measure = Int32.Parse(measure.Attribute("number").Value); updateMeasure(); foreach (XElement note in measure.Elements("note")) { try { if (Int32.Parse(note.Element("voice").Value) == 1) { string aux_type = note.Element("type").Value; if (note.Element("rest") != null) //IF IS A REST { updatePositionNote(aux_type); } if (note.Element("pitch") != null) //IF HAS A PITCH { NoteMusicSheet noteMusicSheet = null; XElement pitch = note.Element("pitch"); int aux_octave = Int32.Parse(pitch.Element("octave").Value); PianoDriver.KeyNote aux_note = ParsePitch(pitch.Element("step").Value, aux_octave); int finger = 0; if (pitch.Element("alter") != null) //IF IT IS ALTERED { //Debug.Log(Int32.Parse(pitch.Element("alter").Value)); aux_note += Int32.Parse(pitch.Element("alter").Value); } if (note.Element("chord") == null) //IF IS NOT A CHORD { noteMusicSheet = new NoteMusicSheet(actual_measure, actual_beat, actual_partbeat, aux_note, finger); updatePositionNote(aux_type); } else { noteMusicSheet = new NoteMusicSheet(previous_measure, previous_beat, previous_partbeat, aux_note, finger); } try { noteMusicSheet.Finger = Int32.Parse(note.Element("notations").Element("technical").Element("fingering").Value); }catch { } //Debug.Log("NEW NOTE "+aux_note+" IN MEASURE "+ actual_measure+" BEAT "+actual_beat); MusicSheetNotes.Add(noteMusicSheet); } } } catch (Exception exc) { } } } this.Notes = MusicSheetNotes; }