public void Update(GameTime gameTime) { Game.previousKeyBoardState = Game.aCurrentKeyboardState; Game.aCurrentKeyboardState = Keyboard.GetState(); elapsed += (float)gameTime.ElapsedGameTime.TotalSeconds; if (elapsed <= 5) { } else { currentState = CurentState.Continue; } if (currentState == CurentState.Continue) { if (Game.aCurrentKeyboardState.IsKeyDown(Keys.Enter)) { Game.gameState = Game.GameMode.LicenceScreen; } } if (timer >= 150f) { timer = 0f; } else { timer++; } }
public void Update() { if (_pause) { return; } CurentState?.OnStateUpdate(); }
private void SwitchToNewState(MainMenuStates nextState) { CurentState?.ExitState(); CurentState = _availableStates[nextState]; CurentState?.EnterState(); OnStateChanged?.Invoke(CurentState); }
private void Update() { if (CurentState == null) { CurentState = _availableStates.Values.First(); CurentState.EnterState(); } MainMenuStates nextState = CurentState.Tick(); Debug.Log(CurentState); PreviousState = CurentState; if (nextState != MainMenuStates.Null && _availableStates[nextState]?.GetType() != CurentState?.GetType()) { SwitchToNewState(nextState); } }
public void SendNewStateToCurentState(int newState) { CurentState.ChangeState((MainMenuStates)(newState)); }