void Update() { myMetronomeSyncer.SetNewValue(main.currentTempo); myTempoSyncer.SetNewValue(main.currentTempo); myMeterSyncer.SetNewValue((float)main.currentMeter); if (main.adcFlag && main.currentInstrument != "" && !sporkWaiting) { StartCoroutine(SyncLoopWithMetronome()); } }
// Update is called once per frame void Update() { //update tempo myTempoSyncer.SetNewValue(currentTempo); //check if play keys have been hit if (Input.GetKeyDown(playRight)) { playRightFlag = true; playLeftFlag = false; } else if (Input.GetKeyDown(playLeft)) { playLeftFlag = true; playRightFlag = false; } // if not, reset else if (Input.GetKeyDown(stopPlay) || Input.GetKeyUp(spaceBar)) { playRightFlag = false; playLeftFlag = false; beatCount = 0; xpos = startPos; transform.position = new Vector3(xpos, 0, 0); //set to start pos } // if in play mode or record mode, update xposition if (playRightFlag || playLeftFlag || Input.GetKey(spaceBar) && beatFlag) { beatFlag = false; xpos = beatCount - paintGM.canvasWidth / 2.0f; //shift to center around 0 if (playRightFlag || playLeftFlag) { transform.position = new Vector3(xpos, 0, 0); //update player line } } }