Предыдущая Следующая
{
gameState = CurentGameState.AboutScreen;
}
if(aReleased == true && state == 4)
{
gameState = CurentGameState.BooksScreen;
}
if(aReleased == true && state == 5)
{
this.Exit();
} }
Далее в исходном коде класса Gamel и метода Update() в зависимости от значения структурной переменной gameState происходит обновление состояния игры.
case CurentGameState.HelpScreen:
{
if (currentState.Buttons.B == ButtonState.Pressed) gameState = CurentGameState.MenuScreen;
break;
}
case CurentGameState.AboutScreen:
358 Последние штрихи
{
if (currentState.Buttons.B == ButtonState.Pressed) gameState = CurentGameState.MenuScreen;
break;
}
case CurentGameState.BooksScreen:
{
if (currentState.Buttons.B == ButtonState.Pressed) gameState = CurentGameState.MenuScreen;
break;
}
case CurentGameState.GameScreen:
{
if (currentState.Buttons.Back == ButtonState.Pressed) gameState = CurentGameState.MenuScreen;
MoveBall(); GamePadClick();
break;
}
case CurentGameState.GameOverScreen:
{
// переход по меню вверх и вниз
if (currentState.DPad.Down == ButtonState.Pressed && downReleased == true)
{
stateGameOver += 1;
if (stateGameOver > 3) stateGameOver = 1;
}
if (currentState.DPad.Up == ButtonState.Pressed && upReleased == true)
{
stateGameOver -= 1;
if (stateGameOver < 1) stateGameOver = 3;
}
// Нажимаем кнопку A
if (currentState.Buttons.A == ButtonState.Pressed && aReleased == true && stateGameOver == 1)
{
this.NewGame(level);
gameState = CurentGameState.GameScreen;
}
if (currentState.Buttons.A == ButtonState.Pressed && aReleased == true && stateGameOver == 2)
{
gameState = CurentGameState.MenuScreen;
}
if (currentState.Buttons.A == ButtonState.Pressed && aReleased == true && stateGameOver == 3)
{
Смена игровых состояний в классе Gomel
359
this.Exit();
}
break;
}
case CurentGameState.VictoryScreen:
{
// переход по меню вверх и вниз
if (currentState.DPad.Down == ButtonState.Pressed && downReleased == true)
{
stateVictory += 1;
if (stateVictory > 3) stateVictory = 1;
}
if (currentState.DPad.Up == ButtonState.Pressed && upReleased == true)
{
stateVictory -= 1;
if (stateVictory < 1) stateVictory = 3;
}
// Нажимаем кнопку A
if (currentState.Buttons.A == ButtonState.Pressed && aReleased == true && stateVictory == 1)
{
this.NewGame(level);
gameState = CurentGameState.GameScreen;
}
if (currentState.Buttons.A == ButtonState.Pressed && aReleased == true && stateVictory == 2) Предыдущая Следующая
|