Я начал писать игру с использованием XNA Framework и столкнулся с какой-то простой проблемой, я не знаю, как правильно ее решить.
Я показываю меню с использованием Texture2D и используя клавиатуру (или геймпад), я меняю выбранный элемент меню. Моя проблема в том, что текущая функция, используемая для переключения между пунктами меню, слишком быстро. Я мог бы нажать кнопку "вниз", и он пойдет вниз по 5 или 6 пунктам меню (из-за того, что Update() вызывается много раз, обновляя выбранный элемент).
ex.
(> indicate selected)
> MenuItem1
MenuItem2
MenuItem3
MenuItem4
MenuItem5
I press the down key for just a second), then I have this state:
MenuItem1
MenuItem2
MenuItem3
> MenuItem4
MenuItem5
What I want is (until I press the key again)
MenuItem1
> MenuItem2
MenuItem3
MenuItem4
MenuItem5
То, что я ищу, - это способ либо щелкнуть мышью по кнопке вверх/вниз много раз, чтобы перейти от одного пункта меню к другому, либо иметь какое-то минимальное время ожидания, прежде чем перейти к следующему пункт меню.