public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (gameOptions.IsTrial == false) { appState = ApplicationState.LevelComplete; } if ((input.IsNewButtonPress(ButtonMappings.Pad_XBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_XBtn, controllingPlayer[0], out controllingPlayer[1]))) { if (gameOptions.IsTrial == true) { if (controllingPlayer[0].CanBuyGame()) { Guide.ShowMarketplace(controllingPlayer[0]); } } } if ((input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { appState = ApplicationState.Quit; } }
public void Update(int _finalLevel, int _finalScore, ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { if (firstCall == true) { MediaPlayer.IsRepeating = true; MediaPlayer.Volume = gameOptions.MusicVolumeAtPlay; MediaPlayer.Play(mySong); firstCall = false; } finalLevel = _finalLevel; finalScore = _finalScore; if (drawState <= 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { appState = ApplicationState.InitaliseApp; } drawState--; if (drawState > 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { drawState = 0; } base.Update(input, controllingPlayer); if (appState == ApplicationState.InitaliseApp) { MediaPlayer.Stop(); Reset(); } }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if ((input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1])) || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { SetTransitionOut(ApplicationState.Home); } appState = ReturnState(ApplicationState.Options); }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (confirm == true) { switch(quitScreen.Update(input, controllingPlayer)) { case 1: appState = ApplicationState.InitaliseApp; break; case 0: confirm = false; menuIndex = 1; return; } } if (selectedIndex == 0 || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex = 0; appState = ApplicationState.Playing; } else if(selectedIndex == 1) { confirm = true; quitScreen.Reset(); } }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (confirm == true) { switch (quitScreen.Update(input, controllingPlayer)) { case 1: appState = ApplicationState.InitaliseApp; break; case 0: confirm = false; menuIndex = 1; return; } } if (selectedIndex == 0 || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex = 0; appState = ApplicationState.Playing; } else if (selectedIndex == 1) { confirm = true; quitScreen.Reset(); } }
public bool Update(int _fuelLeft, int _livesLeft, int _score, InputState input, PlayerIndex[] controllingPlayer) { fuelLeft = _fuelLeft; livesLeft = _livesLeft; score = _score; if (drawState <= 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { Reset(); return true; } drawState--; if (drawState > 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { drawState = 0; } base.Update(input, controllingPlayer); return false; }
public bool Update(int _fuelLeft, int _livesLeft, int _score, InputState input, PlayerIndex[] controllingPlayer) { fuelLeft = _fuelLeft; livesLeft = _livesLeft; score = _score; if (drawState <= 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { Reset(); return(true); } drawState--; if (drawState > 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { drawState = 0; } base.Update(input, controllingPlayer); return(false); }
public void Update(InputState input, PlayerIndex[] controllingPlayer) { if (loaded < 2) { loaded++; } if ((input.IsNewButtonPress(ButtonMappings.Pad_LeftStickUp, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_LeftStickUp, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex--; } if ((input.IsNewButtonPress(ButtonMappings.Pad_LeftStickDown, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_LeftStickDown, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex++; } menuIndex = (int)MathHelper.Clamp(menuIndex, 0, options.Count - 1); if ((input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { selectedIndex = menuIndex; soundPlayer.PlaySound("Select"); } else { selectedIndex = -1; } if (overlayAlpha > 0.0f && transitionOut == false) { overlayAlpha -= fadeSpeed; overlay.Alpha = overlayAlpha; } if (overlayAlpha < 1.1f && transitionOut == true) { overlayAlpha += fadeSpeed; overlay.Alpha = overlayAlpha; } }
public new int Update(InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (selectedIndex == 0 || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { return 0; } else if (selectedIndex == 1) { return 1; } return -1; }
public new int Update(InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (selectedIndex == 0 || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { return(0); } else if (selectedIndex == 1) { return(1); } return(-1); }
public void Update(GameTime gameTime, ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { switch (appState) { case ApplicationState.LevelComplete: { soundPlayer.StopAllSounds(); if (gameOptions.IsTrial == true && levelCount >= gameOptions.TrialLevel) { appState = ApplicationState.Trial; break; } if (updateScore == false) { playerOne.Score += (playerOne.Fuel * gameOptions.FuelMultiplier) * playerOne.Lives; startPeeps += gameOptions.IncPeeps; if (startPeeps > gameOptions.MaxPeeps) { startPeeps = gameOptions.StartPeeps; playerOne.StartFuel -= gameOptions.DecreaseFuel; } updateScore = true; } if (levelCompleteScreen.Update(playerOne.Fuel, playerOne.Lives, playerOne.Score, input, controllingPlayer)) { updateScore = false; CreateLevel(); appState = ApplicationState.Playing; } break; } case ApplicationState.Playing: { if (isPaused == true) { MediaPlayer.Volume = gameOptions.MusicVolumeAtPlay; isPaused = false; } level.Update(gameTime, input, controllingPlayer, ref appState, ref playerOne); break; } case ApplicationState.Paused: { pauseScreen.Update(ref appState, input, controllingPlayer); break; } } //check for pause button or game pad being disconnected if ((appState != ApplicationState.LevelComplete && appState != ApplicationState.Trial) && ((input.IsNewButtonPress(ButtonMappings.Pad_Start, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_Start, controllingPlayer[0], out controllingPlayer[1])) || input.GamePadConnected(controllingPlayer[0], out controllingPlayer[1]) == GamePadStateValues.Disconnected) ) { if (appState == ApplicationState.Playing) { soundPlayer.StopAllSounds(); pauseScreen.Reset(); MediaPlayer.Volume = gameOptions.MusicVolumeAtPause; appState = ApplicationState.Paused; isPaused = true; } else { appState = ApplicationState.Playing; } } if (appState == ApplicationState.GameComplete || appState == ApplicationState.GameOver) { MediaPlayer.Stop(); } }
public void Update(InputState input, PlayerIndex[] controllingPlayer) { if (loaded < 2) { loaded++; } if((input.IsNewButtonPress(ButtonMappings.Pad_LeftStickUp, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_LeftStickUp, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex--; } if ((input.IsNewButtonPress(ButtonMappings.Pad_LeftStickDown, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_LeftStickDown, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex++; } menuIndex = (int)MathHelper.Clamp(menuIndex, 0, options.Count-1); if ((input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { selectedIndex = menuIndex; soundPlayer.PlaySound("Select"); } else { selectedIndex = -1; } if (overlayAlpha > 0.0f && transitionOut == false) { overlayAlpha -= fadeSpeed; overlay.Alpha = overlayAlpha; } if (overlayAlpha < 1.1f && transitionOut == true) { overlayAlpha += fadeSpeed; overlay.Alpha = overlayAlpha; } }