public override void Update(GameTime gameTime) { float delta = (float)gameTime.ElapsedGameTime.TotalMilliseconds; leftPressed = InputManager.GetValue("left"); rightPressed = InputManager.GetValue("right"); upPressed = InputManager.GetValue("up"); downPressed = InputManager.GetValue("down"); placePressed = InputManager.GetValue("place"); removePressed = InputManager.GetValue("remove"); pausePressed = InputManager.GetValue("pause"); savePressed = InputManager.GetValue("save"); if (beatNotificationOpacity > 0) { beatNotificationOpacity -= beatNotificationOpacityRate; } if (beatNotificationOpacity < 0) { beatNotificationOpacity = 0; } if (Music.beatWait) { Music.beatWait = false; HitBeat(); } if (beginWaitCooldown > 0) { beginWaitCooldown--; } else { if (leftPressed && !prevLeftPressed) { currentColumn--; if (currentColumn < 0) { currentColumn = 3; } } if (rightPressed && !prevRightPressed) { currentColumn++; if (currentColumn > 3) { currentColumn = 0; } } if (upPressed) { if (!prevUpPressed || timeShiftPressLength > timeShiftPressLengthGate) { TimeElapsed = snapTime(TimeElapsed + msPerBeatDiv); } timeShiftPressLength += delta; } if (downPressed) { if (!prevDownPressed || timeShiftPressLength > timeShiftPressLengthGate) { TimeElapsed = snapTime(TimeElapsed - msPerBeatDiv); } timeShiftPressLength += delta; } if (!upPressed && !downPressed) { timeShiftPressLength = 0; } if (placePressed && !prevPlacePressed) { Columns[currentColumn].Add(snapTime(TimeElapsed)); Columns[currentColumn].Sort((a, b) => { return(Math.Sign(a - b)); }); } if (removePressed && !prevRemovePressed) { List <float> column = Columns[currentColumn]; for (int i = 0; i < column.Count; i++) { int noteY = TimeToPosition(column[i]); int halfNoteHeight = NoteHeight / 2; int centerY = noteY + halfNoteHeight; if (centerY - halfNoteHeight <= boardHeight && centerY + halfNoteHeight >= boardHeight) { //destroy the note column.RemoveAt(i); break; } } } if (pausePressed && !prevPausePressed) { if (TimeModifier == 0) { TimeModifier = 1; //MediaPlayer.Play(Music, new TimeSpan((long)(TimeElapsed * TimeSpan.TicksPerMillisecond))); PlayMusic((uint)TimeElapsed); TimeBegan = (float)(gameTime.TotalGameTime.TotalMilliseconds - TimeElapsed); } else { TimeModifier = 0; //MediaPlayer.Pause(); PauseMusic(); } } if (savePressed && !prevSavePressed) { save(); } } prevLeftPressed = leftPressed; prevRightPressed = rightPressed; prevUpPressed = upPressed; prevDownPressed = downPressed; prevPlacePressed = placePressed; prevRemovePressed = removePressed; prevPausePressed = pausePressed; prevSavePressed = savePressed; base.Update(gameTime); }