public override void Update(GameTime gameTime) { #region Input if (ControlManager.GamepadReady == false) { if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { Game.stateManager.ChangeState("IntroSecondState"); } } if (ControlManager.GamepadReady == true) { if (ControlManager.CurrentGamepadState.IsButtonDown(ControlManager.GamepadAction)) { Game.stateManager.ChangeState("IntroSecondState"); } } #endregion introtimer += gameTime.ElapsedGameTime.Milliseconds; if (introtimer > timeInIntro) { Game.stateManager.ChangeState("IntroSecondState"); } }
private void CheckStateChangeCommands() { //State-Changers if (ControlManager.CheckPress(RebindableKeys.Pause) && elapsedSinceKey > elapseDelay && cursorLevel == 1) { BackToOverworldLogic(); } if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > elapseDelay && cursorLevel == 1) { BackToOverworldLogic(); } if (ControlManager.CheckPress(RebindableKeys.Pause) && elapsedSinceKey > elapseDelay && cursorLevel > 1) { cursorLevel = 1; elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Inventory) && elapsedTimeMilliseconds > 200 && elapsedSinceKey > elapseDelay) { BackToOverworldLogic(); } }
public void UpdateBackdropPosition(GameTime gameTime) { distance = Math.Abs(Vector2.Distance(preferredBackdropPosition, backdropPosition)); backdropDirection.RotateTowardsPointSingleTurn(gameTime, backdropPosition, preferredBackdropPosition, 1f); backdropPosition += (backdropSpeed * backdropDirection.GetDirectionAsVector()) * gameTime.ElapsedGameTime.Milliseconds; if (distance > totalDistance / 2) { backdropSpeed += backdropAcc * gameTime.ElapsedGameTime.Milliseconds; } else if (distance <= totalDistance / 2) { backdropSpeed -= backdropAcc * gameTime.ElapsedGameTime.Milliseconds; } pressDelay--; if (pressDelay < 0 && (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckKeyPress(Keys.Enter) || ControlManager.IsLeftMouseButtonClicked())) { backdropSpeed = 0; backdropPosition = preferredBackdropPosition; game.stateManager.ChangeState(nextGameState); moveBackdrop = false; } if (distance < 5) { backdropSpeed = 0; game.stateManager.ChangeState(nextGameState); moveBackdrop = false; } }
public override bool Completed() { if (isOnCompletedCalled) { return(true); } if (Destination is Planet) { return(mission.MissionHelper.IsPlayerOnPlanet(Destination.name)); } else if (Destination is Station) { return(mission.MissionHelper.IsPlayerOnStation(Destination.name)); } else if (Destination is SubInteractiveObject) { return(CollisionDetection.IsRectInRect(game.player.Bounds, Destination.Bounds) && (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && !PopupHandler.IsMenuOpen); } else { return(CollisionDetection.IsRectInRect(game.player.Bounds, Destination.Bounds)); } }
public void Update(GameTime gameTime) { if (IsEnergyLocked) { remainingEnergyLockTime -= gameTime.ElapsedGameTime.Milliseconds; } if (primaryOn) { ShipInventoryManager.currentPrimaryWeapon.Update(player, gameTime); } if (secondaryOn) { ShipInventoryManager.equippedSecondary.Update(player, gameTime); } if (ControlManager.CheckHold(RebindableKeys.Action1)) { UseWeapon((PlayerWeapon)ShipInventoryManager.currentPrimaryWeapon, gameTime); UseWeapon((PlayerWeapon)ShipInventoryManager.equippedSecondary, gameTime); } shotHandlerHelper.Update(); if (ControlManager.CheckPress(RebindableKeys.Action2)) { shotHandlerHelper.ChangePrimary(); } ShipInventoryManager.currentPrimaryWeapon = (PlayerWeapon)shotHandlerHelper.currentPrimary; }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { ButtonControls(gameTime); MouseControls(); if ((ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckPress(RebindableKeys.Pause)) && Game.menuBGController.backdropSpeed.Equals(0)) { Game.menuBGController.SetPreferredBackdropPosition(new Vector2(-101, -703), "MainMenuState"); } else if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { ButtonActions(); } selectedButton = buttons[buttonIndex]; foreach (MenuDisplayObject button in buttons) { button.isActive = false; } selectedButton.isActive = true; base.Update(gameTime); }
public override void Update(GameTime gameTime) { if (cursorIndex == 2) { if (ControlManager.CheckPress(RebindableKeys.Left)) { resIndex--; } else if (ControlManager.CheckPress(RebindableKeys.Right)) { resIndex++; } } if (resIndex > Game1.ResolutionOptions.Count - 1) { resIndex = 0; } else if (resIndex < 0) { resIndex = Game1.ResolutionOptions.Count - 1; } menuOptions[2, 1] = Game1.ResolutionOptions[resIndex].X + " x " + Game1.ResolutionOptions[resIndex].Y; base.Update(gameTime); }
private void ButtonControls() { if (ControlManager.CheckPress(RebindableKeys.Down)) { cursorIndex++; } else if (ControlManager.CheckPress(RebindableKeys.Up)) { cursorIndex--; } if (cursorIndex > options.Count - 1) { cursorIndex = 0; } else if (cursorIndex < 0) { cursorIndex = options.Count - 1; } if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { ButtonActions(); } else if (ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckPress(RebindableKeys.Pause) || ControlManager.CheckPress(RebindableKeys.Help)) { Game.stateManager.ChangeState("OverworldState"); } }
private void ButtonControls(GameTime gameTime) { if (ControlManager.CheckPress(RebindableKeys.Down)) { buttonIndex++; holdTimer = Game.HoldKeyTreshold; PlayHoverSound(); } else if (ControlManager.CheckHold(RebindableKeys.Down)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { buttonIndex++; holdTimer = Game.ScrollSpeedFast; PlayHoverSound(); } } else if (ControlManager.CheckPress(RebindableKeys.Up)) { buttonIndex--; holdTimer = Game.HoldKeyTreshold; PlayHoverSound(); } else if (ControlManager.CheckHold(RebindableKeys.Up)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { buttonIndex--; holdTimer = Game.ScrollSpeedFast; PlayHoverSound(); } } if (buttonIndex < 0) { if (ControlManager.PreviousKeyUp(RebindableKeys.Up)) buttonIndex = buttons.Count - 1; else buttonIndex = 0; } else if (buttonIndex > buttons.Count - 1) { if (ControlManager.PreviousKeyUp(RebindableKeys.Down)) buttonIndex = 0; else buttonIndex = buttons.Count - 1; } }
public override void MissionLogic() { base.MissionLogic(); if (ObjectiveIndex > 2 && ObjectiveIndex <= 6 && !Game.player.HyperspeedOn) { if (Vector2.Distance(Game.player.position, rebelShips[1].position) > 500) { PopupHandler.DisplayPortraitMessage(PortraitID.RebelPilot, "Hey! Where are you going? The freighter will be here any minute now."); Game.player.BounceBack(); } if (ControlManager.CheckPress(RebindableKeys.Pause) && GameStateManager.currentState.Equals("OverworldState")) { PopupHandler.DisplaySelectionMenu("Do you want to skip waiting?", new List <string>() { "Yes", "No" }, new List <System.Action>() { delegate { SkipForward(); }, delegate {} }); } } }
private void CheckStateChangeCommands() { //State-Changers if (ControlManager.CheckPress(RebindableKeys.Pause) && elapsedSinceKey > 100 && cursorLevel == 1) { Game.stateManager.ChangeState(GameStateManager.previousState); } if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100 && cursorLevel == 1) { Game.stateManager.ChangeState(GameStateManager.previousState); } if (ControlManager.CheckPress(RebindableKeys.Pause) && elapsedSinceKey > 100 && cursorLevel > 1) { cursorLevel -= 1; elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Missions) && elapsedTimeMilliseconds > 200 && elapsedSinceKey > 100) { Game.stateManager.ChangeState(GameStateManager.previousState); } }
public virtual void Update(GameTime gameTime) { activeMenuState.Update(gameTime); MouseControls(); if (buttonControl == ButtonControl.Menu) { if (ControlManager.CheckPress(RebindableKeys.Down)) { activeButtonIndexY++; WrapActiveButton(); ActiveMenuState.CursorActions(); } else if (ControlManager.CheckPress(RebindableKeys.Up)) { activeButtonIndexY--; WrapActiveButton(); ActiveMenuState.CursorActions(); } previousButton = activeButton; activeButton = allButtons[activeButtonIndexY]; } else if (buttonControl.Equals(ButtonControl.Mission) || buttonControl.Equals(ButtonControl.Response) || buttonControl.Equals(ButtonControl.Confirm)) { activeButton = null; } if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { ActiveMenuState.ButtonActions(); } foreach (MenuDisplayObject button in allButtons) { if (button != null) { button.isActive = false; } } if (activeButton != null) { activeButton.isActive = true; } missionMenuState.UpdateTextCursorPos(); foreach (TextBox txtBox in textBoxes) { txtBox.Update(gameTime); } }
private static void ButtonControls() { if (ControlManager.CheckPress(RebindableKeys.Pause) && messageQueue.Count > 0) { messageQueue.Clear(); Game1.Paused = false; } }
private void CheckKeysCursorLevel1() { int temporaryCount = cursorManager.displayList.Count; if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100) { if (cursorLevel1Position == 0) { cursorLevel1Position = 3; } else if (cursorLevel1Position == 1) { cursorLevel1Position = 0; } else if (cursorLevel1Position == 2) { cursorLevel1Position = 1; } else if (cursorLevel1Position == 3) { cursorLevel1Position = 2; } elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100) { if (cursorLevel1Position == 0) { cursorLevel1Position = 1; } else if (cursorLevel1Position == 1) { cursorLevel1Position = 2; } else if (cursorLevel1Position == 2) { cursorLevel1Position = 3; } else if (cursorLevel1Position == 3) { cursorLevel1Position = 0; } elapsedSinceKey = 0; elapsedSinceKey = 0; } if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && elapsedSinceKey > 100) { OnPressCursorLevel1(); } }
private void CheckGameOverUserInput() { if (ControlManager.CheckKeyPress(Keys.R) && !isPirateLevel) { this.Initialize(); } else if (ControlManager.CheckPress(RebindableKeys.Action2)) { LeaveLevel(); } }
public override void Update(GameTime gameTime) { if (ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckPress(RebindableKeys.Pause)) { if (BaseStateManager.ButtonControl.Equals(ButtonControl.SelectShop)) { OnEnter(); } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { textBoxLeft.Update(gameTime); textBoxRight.Update(gameTime); if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter) || ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckKeyPress(Keys.Escape) || ControlManager.IsLeftMouseButtonClicked()) { Game.stateManager.ChangeState("MainMenuState"); } }
public virtual void Update(GameTime gameTime) { if (ControlManager.CheckPress(RebindableKeys.Pause) || ControlManager.CheckPress(RebindableKeys.Action2)) { if (BaseStateManager.ButtonControl != ButtonControl.Confirm && BaseStateManager.ButtonControl != ButtonControl.Response) { if (BaseStateManager.ActiveMenuState.Equals(BaseStateManager.OverviewMenuState)) { if (StatsManager.gameMode != GameMode.Campaign) { Game.stateManager.ChangeState("OverworldState"); } else { Game.stateManager.ChangeState("CampaignState"); } } else if (BaseStateManager.ActiveMenuState.Equals(BaseStateManager.MissionMenuState) && BaseStateManager.ButtonControl.Equals(ButtonControl.Mission)) { BaseState.HideOverlay(); BaseStateManager.ChangeMenuSubState("Overview"); } else if (BaseStateManager.ActiveMenuState.Equals(BaseStateManager.MissionMenuState) && BaseStateManager.ButtonControl.Equals(ButtonControl.Response)) { BaseStateManager.ActiveButton = BaseStateManager.AllButtons[BaseStateManager.ActiveButtonIndexY]; BaseStateManager.MissionMenuState.SelectMission(); } else if (BaseStateManager.ActiveMenuState.Equals(BaseStateManager.ShopMenuState)) { BaseStateManager.ActiveButton = BaseStateManager.AllButtons[BaseStateManager.ActiveButtonIndexY]; BaseStateManager.ButtonControl = ButtonControl.Second; BaseStateManager.ChangeMenuSubState("Overview"); } } } }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (ControlManager.CheckPress(RebindableKeys.Right)) { VolumeControl("right"); } else if (ControlManager.CheckPress(RebindableKeys.Left)) { VolumeControl("left"); } if (!SoundEffectsManager.LoadSoundEffects) { game.soundEffectsManager.SetSoundMuted(true); menuOptions[2, 1] = "Off"; } }
private void CheckKeyboard() { if (ControlManager.CheckPress(RebindableKeys.Pause) && timeSinceStarted > 200) { PopupHandler.DisplayMenu(); } if (ControlManager.CheckKeyPress(Keys.Y)) { //Game.messageBox.DisplayMessage("Hello world!"); Game.soundEffectsManager.MutateLaserSound_DEVELOP(); } //if (ControlManager.CheckKeypress(Keys.F1)) // AlliedShip.ShowSightRange = !AlliedShip.ShowSightRange; if (StatsManager.gameMode == GameMode.Develop || StatsManager.gameMode == GameMode.Campaign) { DevelopCommands(); } }
public override void Update(GameTime gameTime) { MouseControls(); if (activeOptionState != null && Game.menuBGController.DisplayButtons) { activeOptionState.Update(gameTime); } else if (Game.menuBGController.DisplayButtons) { ButtonControls(gameTime); if ((ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckPress(RebindableKeys.Pause)) && Game.menuBGController.backdropSpeed.Equals(0)) { if (GameStateManager.previousState == "MainMenuState") { Game.menuBGController.SetPreferredBackdropPosition(new Vector2(-101, -703), "MainMenuState"); } else { Game.stateManager.ChangeState("OverworldState"); } } else if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { ButtonActions(); } } selectedButton = buttons[buttonIndex]; foreach (MenuDisplayObject button in buttons) button.isActive = false; selectedButton.isActive = true; }
public virtual void Update(GameTime gameTime) { foreach (GameObjectOverworld obj in gameObjects) { obj.Update(gameTime); } if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && !game.player.HyperspeedOn && !game.stateManager.overworldState.IsBurnOutEndingActivated) { EnterCheck(); } if (garbageGameObjects.Count > 0) { DeleteRemovedGameObjects(); } ShopManager.UpdateShops(gameObjects); }
private void CheckKeysLevel1() { int temporaryCount = cursorManager.displayList.Count; if (ControlManager.CheckPress(RebindableKeys.Down) && cursorLevel == 1 && elapsedSinceKey > elapseDelay) { cursorCoordLv1.MoveCursor(0, 1); elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Up) && cursorLevel == 1 && elapsedSinceKey > elapseDelay) { cursorCoordLv1.MoveCursor(0, -1); elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Left) && cursorLevel == 1 && elapsedSinceKey > elapseDelay) { cursorCoordLv1.MoveCursor(-1, 0); elapsedSinceKey = 0; } if (ControlManager.CheckPress(RebindableKeys.Right) && cursorLevel == 1 && elapsedSinceKey > elapseDelay) { cursorCoordLv1.MoveCursor(1, 0); elapsedSinceKey = 0; } if (((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && cursorLevel == 1 && elapsedSinceKey > elapseDelay)) { OnPressLevel1(); } }
private void ButtonControls() { if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { OnPress(RebindableKeys.Action1); } else if (ControlManager.CheckPress(RebindableKeys.Action2)) { OnPress(RebindableKeys.Action2); } else if (ControlManager.CheckPress(RebindableKeys.Pause) || ControlManager.CheckKeyPress(Keys.Escape)) { OnPress(RebindableKeys.Pause); } else if (ControlManager.CheckPress(RebindableKeys.Right)) { OnPress(RebindableKeys.Right); } else if (ControlManager.CheckPress(RebindableKeys.Left)) { OnPress(RebindableKeys.Left); } else if (ControlManager.CheckPress(RebindableKeys.Up)) { OnPress(RebindableKeys.Up); } else if (ControlManager.CheckPress(RebindableKeys.Down)) { OnPress(RebindableKeys.Down); } else if (ControlManager.IsLeftMouseButtonClicked()) { OnPress(RebindableKeys.Action1); } }
private void ButtonControls() { if (ControlManager.CheckPress(RebindableKeys.Down)) { cursorIndex++; } else if (ControlManager.CheckPress(RebindableKeys.Up)) { cursorIndex--; } if (cursorIndex > options.Count - 1) { cursorIndex = 0; } else if (cursorIndex < 0) { cursorIndex = options.Count - 1; } if (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) { if (cursorIndex < beacons.Count) { currentBeacon.StartJump(beacons[cursorIndex]); } Hide(); } if (ControlManager.CheckPress(RebindableKeys.Action2) || ControlManager.CheckKeyPress(Keys.Escape)) { Hide(); } }
private void Inputhandling() { if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter))) { EnterCheck(); } else if (ControlManager.CheckPress(RebindableKeys.Pause) && Game.player.IsControlsEnabled && (MissionManager.GetMission(MissionID.Main5_Retribution).MissionState != StateOfMission.Active || (MissionManager.GetMission(MissionID.Main5_Retribution).ObjectiveIndex <= 2 || MissionManager.GetMission(MissionID.Main5_Retribution).ObjectiveIndex >= 6))) { PopupHandler.DisplayMenu(); } else if (ControlManager.CheckPress(RebindableKeys.Missions)) { Game.stateManager.ChangeState("MissionScreenState"); } else if (ControlManager.CheckPress(RebindableKeys.Inventory)) { Game.stateManager.ChangeState("ShipManagerState"); Game.stateManager.shooterState.Initialize(); } else if (ControlManager.CheckPress(RebindableKeys.Help)) { Game.stateManager.ChangeState("HelpScreenState"); } if (StatsManager.gameMode == GameMode.Develop && ControlManager.CheckKeyPress(Keys.U)) { DevelopCommands(); } }
protected override void SetupObjectives() { float time = 0; objectives.Clear(); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], delegate { SetupAllyShips(allyShips1, fortrunStation.position, newNorrland); }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.OutsideFortrun1), null, EventTextCanvas.MessageBox, PortraitID.Sair), delegate { time = StatsManager.PlayTime.GetFutureOverworldTime(500); }, delegate { }, delegate { return(StatsManager.PlayTime.HasOverworldTimePassed(time)); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.OutsideFortrun2), null, EventTextCanvas.MessageBox, PortraitID.Ai), delegate { readyToLeave = false; allyShipRectangle = new Rectangle( (int)allyShips1[0].position.X - AllyShipRectOffset, (int)allyShips1[0].position.Y - AllyShipRectOffset, AllyShipRectWidth, AllyShipRectHeight); PopupHandler.DisplayPortraitMessage(PortraitID.Ai, "[Ai] \"Talk to the alliance ships waiting outside Fortrun when you're ready to leave.\"#\"Don't forget to stop by the shop and upgrade your equipment if you have not done so already!\""); }, delegate { if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) && (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && GameStateManager.currentState.Equals("OverworldState")) { PopupHandler.DisplaySelectionMenu("[Ai] Ready to go?", new List <string>() { "Yes", "No" }, new List <System.Action>() { delegate { readyToLeave = true; }, delegate { readyToLeave = false; } }); } }, delegate { return(readyToLeave); }, delegate { return(false); })); AutoPilotObjective autoPilotObjective1 = new AutoPilotObjective(Game, this, ObjectiveDescriptions[1], AutoPilotSpeed, allyShips1, fortrunStation.position, new EventTextCapsule(GetEvent((int)EventID.OutsideNewNorrland), null, EventTextCanvas.MessageBox, PortraitID.Ai)); autoPilotObjective1.Initialize(); autoPilotObjective1.SetTimedMessages(new Dictionary <string, List <float> > { { GetEvent((int)EventID.ToNewNorrland1).Text, new List <float> { 3000, 3000 } }, { GetEvent((int)EventID.ToNewNorrland2).Text, new List <float> { 20000, 3000 } } }, null, null); objectives.Add(autoPilotObjective1); objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1], "DefendColonyBreak", LevelStartCondition.TextCleared)); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.FirstLevelCompleted), null, EventTextCanvas.MessageBox, PortraitID.Ai), delegate { Game.stateManager.GotoPlanetSubScreen("New Norrland", "Overview"); }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1], "DefendColonyHold", LevelStartCondition.TextCleared, new EventTextCapsule(GetEvent((int)EventID.SecondLevelCompleted), null, EventTextCanvas.MessageBox, PortraitID.Ai))); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1], delegate { RemoveShips(allyShips1); SetupAllyShips(allyShips2, new Vector2(newNorrland.position.X + 0, newNorrland.position.Y - 625), fortrunStation); }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[2], new EventTextCapsule(new EventText("[Ai] \"Let's go\""), null, EventTextCanvas.MessageBox, PortraitID.Ai), delegate { allyShipRectangle = new Rectangle( (int)allyShips2[0].position.X - AllyShipRectOffset, (int)allyShips2[0].position.Y - AllyShipRectOffset, AllyShipRectWidth, AllyShipRectHeight); readyToLeave = false; PopupHandler.DisplayPortraitMessage(PortraitID.Ai, "[Ai] \"Talk to the alliance ships waiting outside New Norrland when you're ready to leave.\""); }, delegate { if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) && (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && GameStateManager.currentState.Equals("OverworldState")) { PopupHandler.DisplaySelectionMenu("[Ai] Ready to head back?", new List <string>() { "Yes", "No" }, new List <System.Action>() { delegate { readyToLeave = true; }, delegate { readyToLeave = false; } }); } }, delegate { return(readyToLeave); }, delegate { return(false); })); AutoPilotObjective autoPilotObjective = new AutoPilotObjective(Game, this, ObjectiveDescriptions[3], AutoPilotSpeed2, allyShips2, newNorrland.position, false); autoPilotObjective.Initialize(); autoPilotObjective.SetActivateRealTimeIndex(2); autoPilotObjective.SetTimedMessages( new Dictionary <string, List <float> > { { GetEvent((int)EventID.ToFortrun1).Text, new List <float> { 7000, 3000 } }, { GetEvent((int)EventID.ToFortrun2).Text, new List <float> { 1000, 3000 } }, { GetEvent((int)EventID.ToFortrun3).Text, new List <float> { 4000, 3000 } }, }, new List <List <PortraitID> >() { new List <PortraitID> { PortraitID.Sair, PortraitID.CommonCitizen }, new List <PortraitID> { PortraitID.Ai }, new List <PortraitID> { PortraitID.Sair } }, new List <List <int> > { new List <int> { 1 }, new List <int> { }, new List <int> { } }); objectives.Add(autoPilotObjective); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[3], delegate { RemoveShips(allyShips2); Game.stateManager.GotoStationSubScreen("Fortrun Station", "Mission"); }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[3])); }
protected override void SetupObjectives() { objectives.Clear(); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], delegate { SetupAllyShips(allyShips1, destinations[0].position, destinations[1]); }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.OutsideRebelStation1), null, EventTextCanvas.MessageBox, PortraitID.Sair), delegate { }, delegate { }, delegate { return(GameStateManager.currentState.ToLower().Equals("overworldstate")); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.AtRebelRendezvous), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader), delegate { readyToLeave = false; allyShipRectangle = new Rectangle( (int)allyShips1[0].position.X - AllyShipRectOffset, (int)allyShips1[0].position.Y - AllyShipRectOffset, AllyShipRectWidth, AllyShipRectHeight); PopupHandler.DisplayPortraitMessage(PortraitID.Rok, "[Rok] \"Talk to the ships waiting nearby our base when you're ready to leave.\""); }, delegate { if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) && (ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && GameStateManager.currentState.Equals("OverworldState")) { PopupHandler.DisplaySelectionMenu("[Rebel Pilot] Ready to go?", new List <string>() { "Yes", "No" }, new List <System.Action>() { delegate { readyToLeave = true; }, delegate { readyToLeave = false; } }); } }, delegate { return(readyToLeave); }, delegate { return(false); })); //objectives.Add(new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[0], // 200, new EventTextCapsule(GetEvent((int)EventID.AtRebelRendezvous), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader))); AutoPilotObjective autoPilotObjective = new AutoPilotObjective(Game, this, ObjectiveDescriptions[0], AutoPilotSpeed, allyShips1, destinations[3].position, new EventTextCapsule(GetEvent((int)EventID.ArriveAtScienceStation), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader), false); autoPilotObjective.Initialize(); autoPilotObjective.SetTimedMessages(new Dictionary <string, List <float> > { { GetEvent((int)EventID.TravelToScienceStation1).Text, new List <float> { 5000, 3000 } }, { GetEvent((int)EventID.TravelToScienceStation2).Text, new List <float> { 1000, 3000 } }, { GetEvent((int)EventID.TravelToScienceStation3).Text, new List <float> { 13000, 3000 } } } , new List <List <PortraitID> >() { new List <PortraitID> { PortraitID.Ai }, new List <PortraitID> { PortraitID.Sair }, new List <PortraitID> { PortraitID.Ai } } , new List <List <int> > { new List <int> { }, new List <int> { }, new List <int> { } }); objectives.Add(autoPilotObjective); objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[0], "Itnos_1", LevelStartCondition.TextCleared, new EventTextCapsule(GetEvent((int)EventID.AfterLevel1), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader))); objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation1), null, EventTextCanvas.MessageBox, PortraitID.Sair))); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation2), null, EventTextCanvas.MessageBox), delegate { }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0], new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation3), null, EventTextCanvas.MessageBox, PortraitID.Ente), delegate { }, delegate { }, delegate { return(true); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1], new EventTextCapsule(GetEvent((int)EventID.OutsideScienceStation), null, EventTextCanvas.MessageBox, PortraitID.Sair), delegate { RemoveShips(); }, delegate { }, delegate { return(GameStateManager.currentState == "OverworldState"); }, delegate { return(false); })); objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1], new EventTextCapsule(GetEvent((int)EventID.BreakThroughLevel), null, EventTextCanvas.MessageBox, PortraitID.Sair), delegate { hangarAttackTime = StatsManager.PlayTime.GetFutureOverworldTime(2000); }, delegate { }, delegate { return(StatsManager.PlayTime.HasOverworldTimePassed(hangarAttackTime)); }, delegate { return(false); })); objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1], "Itnos_2", LevelStartCondition.TextCleared, new EventTextCapsule(GetEvent((int)EventID.AfterLevel2), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader))); objectives.Add(new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[1], 200, new EventTextCapsule(GetEvent((int)EventID.OutsideRebelStation2), null, EventTextCanvas.MessageBox, PortraitID.Ente))); objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[1])); }
public override void Update(GameTime gameTime) { if (BaseState.GetBase() != null) { availableMissions = MissionManager.ReturnAvailableMissions(BaseState.GetBase().name); } if (BaseStateManager.ButtonControl.Equals(ButtonControl.Mission) || BaseStateManager.ButtonControl.Equals(ButtonControl.Response)) { missionCursor.isActive = true; missionCursor.isVisible = true; } else { missionCursor.isActive = false; missionCursor.isVisible = false; } if (BaseStateManager.ButtonControl == ButtonControl.Mission) { //Moves button cursor right when pressing up. if (ControlManager.CheckPress(RebindableKeys.Up)) { missionCursorIndex--; } //Moves button cursor left when pressing down else if (ControlManager.CheckPress(RebindableKeys.Down)) { missionCursorIndex++; } if (MissionCursorIndex > availableMissions.Count) { missionCursorIndex = 0; } else if (MissionCursorIndex < 0) { missionCursorIndex = availableMissions.Count; } for (int i = 0; i < availableMissions.Count + 1; i++) { String text = i != availableMissions.Count ? availableMissions[i].MissionName : "Back"; if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(14), text, new Vector2(Game1.ScreenSize.X / 2, Game1.ScreenSize.Y / 2 - 40 + (20 * (i + (i == availableMissions.Count ? 1 : 0))) + FindTextBoxWithText(text).TextBoxRect.Height))) { if (ControlManager.IsMouseMoving()) { missionCursorIndex = i; } } } if (availableMissions.Count > 0 && missionCursorIndex != availableMissions.Count) { selectedMission = availableMissions[MissionCursorIndex]; } } else if (BaseStateManager.ButtonControl == ButtonControl.Response) { //Moves button cursor right when pressing up. if (ControlManager.CheckPress(RebindableKeys.Up)) { responseCursorIndex--; } //Moves button cursor left when pressing down else if (ControlManager.CheckPress(RebindableKeys.Down)) { responseCursorIndex++; } if (MissionManager.MissionResponseBuffer.Count <= 0) { if (ControlManager.IsMouseOverArea(new Rectangle( BaseStateManager.ResponseRectangles[0].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X / 2, BaseStateManager.ResponseRectangles[0].Y + BaseStateManager.ResponseRectangles[0].Height / 2, (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).X, (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.PosResponse).Y))) { responseCursorIndex = 0; } else if (ControlManager.IsMouseOverArea(new Rectangle( BaseStateManager.ResponseRectangles[1].X - (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X / 2, BaseStateManager.ResponseRectangles[1].Y + BaseStateManager.ResponseRectangles[1].Height / 2, (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).X, (int)FontManager.GetFontStatic(14).MeasureString(selectedMission.NegResponse).Y))) { responseCursorIndex = 1; } if (responseCursorIndex > 1) { responseCursorIndex = 0; } else if (responseCursorIndex < 0) { responseCursorIndex = 1; } } else { for (int i = 0; i < MissionManager.MissionResponseBuffer.Count; i++) { if (ControlManager.IsMouseOverArea(new Rectangle( BaseStateManager.ResponseRectangles[i].X - (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X / 2, BaseStateManager.ResponseRectangles[i].Y + BaseStateManager.ResponseRectangles[i].Height / 2, (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).X, (int)FontManager.GetFontStatic(14).MeasureString(MissionManager.MissionResponseBuffer[i]).Y))) { responseCursorIndex = i; } } if (responseCursorIndex > MissionManager.MissionResponseBuffer.Count - 1) { responseCursorIndex = 0; } else if (responseCursorIndex < 0) { responseCursorIndex = MissionManager.MissionResponseBuffer.Count - 1; } } } if (BaseStateManager.ButtonControl != ButtonControl.Response && ControlManager.CheckPress(RebindableKeys.Pause)) { SkipMissionText(); } else { base.Update(gameTime); } }
private void CheckKeysLevel2(GameTime gameTime) { if (cursorLevel == 2 && cursorCoordLv1.Position != inventoryPos) { int listLength; if (cursorCoordLv1.Position != 5) { listLength = ShipInventoryManager.ownCounts[cursorCoordLv1.Position - 1]; } else { if (cursorCoordLv1.Y == 0) { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(1).Count; } else { listLength = ShipInventoryManager.GetAvailablePrimaryWeapons(2).Count; } } if (ControlManager.CheckPress(RebindableKeys.Down) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel2Position += 1; if (cursorLevel2Position > listLength) { cursorLevel2Position = 0; } elapsedSinceKey = 0; holdTimer = Game.HoldKeyTreshold; } else if (ControlManager.CheckHold(RebindableKeys.Down)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { cursorLevel2Position += 1; if (cursorLevel2Position > listLength) { cursorLevel2Position = listLength; } elapsedSinceKey = 0; holdTimer = Game.ScrollSpeedFast; } } if (ControlManager.CheckPress(RebindableKeys.Up) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel2Position -= 1; if (cursorLevel2Position < 0) { cursorLevel2Position = listLength; } elapsedSinceKey = 0; holdTimer = Game.HoldKeyTreshold; } else if (ControlManager.CheckHold(RebindableKeys.Up)) { holdTimer -= gameTime.ElapsedGameTime.Milliseconds; if (holdTimer <= 0) { cursorLevel2Position -= 1; if (cursorLevel2Position < 0) { cursorLevel2Position = 0; } elapsedSinceKey = 0; holdTimer = Game.ScrollSpeedFast; } } //This is where the magic happens. if (((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) && cursorLevel == 2 && elapsedSinceKey > elapseDelay)) { if (cursorLevel2Position < listLength) { OnPressLevel2(); } else { cursorLevel = 1; elapsedSinceKey = 0; } } if (ControlManager.CheckPress(RebindableKeys.Action2) && cursorLevel == 2 && elapsedSinceKey > elapseDelay) { cursorLevel = 1; elapsedSinceKey = 0; } } }