public void Press() { render.material = activate_material; if (active == true) //If a note has enter into the trigger and the key pressed { Destroy(note); GameObject.FindGameObjectWithTag("SheetManager").GetComponent <MusicSheetManager>().IncreaseScore(); GameObject.FindGameObjectWithTag(KeyNote.ToString()).GetComponent <PianoKey>().PressHit(); active = false; createEffect(); } else { GameObject.FindGameObjectWithTag("SheetManager").GetComponent <MusicSheetManager>().DecreaseScore(); GameObject.FindGameObjectWithTag(KeyNote.ToString()).GetComponent <PianoKey>().PressMiss(); } }
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); }