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;
            }
        }
Пример #2
0
 private void DevelopCommands()
 {
     if (ControlManager.CheckKeyPress(Keys.F))
     {
         currentLevel.finishLevel_DEVELOPONLY();
     }
 }
Пример #3
0
        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));
            }
        }
Пример #4
0
        public override void Update(GameTime gameTime)
        {
            if (ControlManager.CheckKeyPress(Keys.Escape))
            {
                Game.Restart();
            }

            if (scrolling)
            {
                UpdateScrolling(gameTime);
            }
            else
            {
                if (textTimer % 5 == 0 &&
                    text.Count > 0)
                {
                    bool temp;
                    currentLine = TextUtils.ScrollText(text[0], false, out temp);
                }

                UpdateFading(gameTime);
            }

            textBox.Update(gameTime);
        }
        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");
            }
        }
Пример #6
0
        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);
        }
Пример #7
0
        private void InputhandlingDebug()
        {
            //Changes states to play-state and playerstats-state
            if (ControlManager.CheckKeyPress(Keys.P))
            {
                Game.stateManager.shooterState.BeginLevel("Level1");
            }
            if (ControlManager.CheckKeyPress(Keys.E))
            {
                Game.stateManager.shooterState.BeginLevel("ExperimentLevel");
            }

            if (ControlManager.CheckKeyPress(Keys.U))
            {
                Game.stateManager.shooterState.BeginLevel("EscortLevel");
            }

            if (ControlManager.CheckKeyPress(Keys.Y))
            {
                PopupHandler.DisplayMessage("Player position: " + Game.player.position.ToString());
            }

            if (ControlManager.CheckKeyPress(Keys.F12))
            {
                ActivateBurnOutEnding();
            }
        }
        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");
            }
        }
        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);
            }
        }
Пример #10
0
        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();
            }
        }
Пример #11
0
        private void UpdateControls()
        {
            if (ControlManager.CheckKeyPress(Keys.Enter))
            {
                int startTime = 0;

                Game.stateManager.shooterState.SetupTestLevelRun(chosenLevelTesterEntry.GetLevelEntry(), startTime);
                StatsManager.SetCustomDamageFactor_DEVELOPONLY(lifeFactor);
                Game.stateManager.shooterState.BeginTestLevel();
            }

            if (ControlManager.CheckKeyPress(Keys.Escape))
            {
                Game.stateManager.ChangeState("MainMenuState");
            }

            if (ControlManager.CheckKeyPress(Keys.D1))
            {
                Game.stateManager.stationState.LoadStationData(Game.stateManager.overworldState.GetStation("Highfence Shop"));
                Game.stateManager.ChangeState("StationState");
            }

            if (ControlManager.CheckKeyPress(Keys.D2) && currentLevel >= checkpoint1)
            {
                Game.stateManager.stationState.LoadStationData(Game.stateManager.overworldState.GetStation("Fortrun Shop"));
                Game.stateManager.ChangeState("StationState");
            }

            if (ControlManager.CheckKeyPress(Keys.D3) && currentLevel >= checkpoint2)
            {
                Game.stateManager.stationState.LoadStationData(Game.stateManager.overworldState.GetStation("Rebel Base Shop"));
                Game.stateManager.ChangeState("StationState");
            }

            if (ControlManager.CheckKeyPress(Keys.D4) && currentLevel >= checkpoint3)
            {
                Game.stateManager.stationState.LoadStationData(Game.stateManager.overworldState.GetStation("Peye Shop"));
                Game.stateManager.ChangeState("StationState");
            }

            if (ControlManager.CheckKeyPress(Keys.Space))
            {
                standardEquipEnabled = true;
            }

            if (ControlManager.CheckKeyPress(Keys.M))
            {
                crebits += 1000;
            }

            if (ControlManager.CheckKeyPress(Keys.N))
            {
                currentLevel += 1;
            }
        }
        private void ApplyEquipments()
        {
            String equipInfo = "";

            if (ControlManager.CheckKeyPress(Keys.D1))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(1);
            }

            if (ControlManager.CheckKeyPress(Keys.D2))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(2);
            }

            if (ControlManager.CheckKeyPress(Keys.D3))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(3);
            }

            if (ControlManager.CheckKeyPress(Keys.D4))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(4);
            }

            if (ControlManager.CheckKeyPress(Keys.D5))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(5);
            }

            if (ControlManager.CheckKeyPress(Keys.D6))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(6);
            }

            if (ControlManager.CheckKeyPress(Keys.D7))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(7);
            }

            if (ControlManager.CheckKeyPress(Keys.D8))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(8);
            }

            if (ControlManager.CheckKeyPress(Keys.D9))
            {
                equipInfo = ShipInventoryManager.MapCreatorEquip(9);
            }

            if (equipInfo != "")
            {
                gui.SetEquipInfo(equipInfo);
            }
        }
Пример #13
0
 private void CheckGameOverUserInput()
 {
     if (ControlManager.CheckKeyPress(Keys.R) && !isPirateLevel)
     {
         this.Initialize();
     }
     else if (ControlManager.CheckPress(RebindableKeys.Action2))
     {
         LeaveLevel();
     }
 }
Пример #14
0
        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 override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            freighterHpBar.Update(gameTime, freighter.HP, freighter.HPmax, new Vector2(10, 30));

            if (ControlManager.CheckKeyPress(Microsoft.Xna.Framework.Input.Keys.Insert))
            {
                freighter.HP = 0;
            }

            if (freighter.HP <= 0)
            {
                player.HP = 0;
            }
        }
Пример #16
0
        private void ChooseLevel()
        {
            // Checks if one of the level-keys is pressed. If so, assign that as chosenLevel

            List <LevelTesterEntry> combined = GetAllEntries();

            foreach (LevelTesterEntry entry in combined)
            {
                Keys entryKey = entry.GetKey();

                if (ControlManager.CheckKeyPress(entryKey))
                {
                    chosenLevel = entry.GetLevelEntry();
                    CheckStandardEquip(entry);
                    break;
                }
            }
        }
Пример #17
0
        private void MapCompletionLogic()
        {
            EndText = "";
            if (missionType.Equals(MissionType.alliancepirate) || missionType.Equals(MissionType.rebelpirate))
            {
                EndText = "You earned: " + (int)(LevelLoot * StatsManager.moneyFactor) + " crebits. \n";
            }
            EndText += "Press 'Enter' to continue..";

            if (StatsManager.gameMode == GameMode.Hardcore)
            {
                StatsManager.ReduceOverwordHealthToVerticalHealth(player);
            }

            if (ControlManager.CheckKeyPress(Keys.Enter))
            {
                LeaveLevel();
            }
        }
Пример #18
0
 // Evaluates if a number key is pressed. If so, tells the ShipInventoryManager
 // to equip corresponding equipment set.
 private void ApplyEquipments()
 {
     if (ControlManager.CheckKeyPress(Keys.D1))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(1);
     }
     else if (ControlManager.CheckKeyPress(Keys.D2))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(2);
     }
     else if (ControlManager.CheckKeyPress(Keys.D3))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(3);
     }
     else if (ControlManager.CheckKeyPress(Keys.D4))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(4);
     }
     else if (ControlManager.CheckKeyPress(Keys.D5))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(5);
     }
     else if (ControlManager.CheckKeyPress(Keys.D6))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(6);
     }
     else if (ControlManager.CheckKeyPress(Keys.D7))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(7);
     }
     else if (ControlManager.CheckKeyPress(Keys.D8))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(8);
     }
     else if (ControlManager.CheckKeyPress(Keys.D9))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(9);
     }
     else if (ControlManager.CheckKeyPress(Keys.D0))
     {
         equipInfo = ShipInventoryManager.MapCreatorEquip(0);
     }
 }
Пример #19
0
        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;
        }
Пример #20
0
        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();
            }
        }
Пример #21
0
        private void UpdateControls()
        {
            if (ControlManager.CheckKeyPress(Keys.Enter))
            {
                int startTime = 0;

                Game.stateManager.shooterState.SetupTestLevelRun(chosenLevel, startTime);
                StatsManager.SetCustomDamageFactor_DEVELOPONLY(lifeFactor);
                Game.stateManager.shooterState.BeginTestLevel();
            }

            if (ControlManager.CheckKeyPress(Keys.Escape))
            {
                Game.stateManager.ChangeState("MainMenuState");
            }

            if (ControlManager.CheckKeyPress(Keys.Up))
            {
                if (lifeFactor < lifeFactorInterval)
                {
                    lifeFactor = lifeFactorInterval;
                }
                else
                {
                    lifeFactor += lifeFactorInterval;
                }
            }

            if (ControlManager.CheckKeyPress(Keys.Down))
            {
                if (lifeFactor > lifeFactorInterval)
                {
                    lifeFactor -= lifeFactorInterval;
                }
                else
                {
                    lifeFactor = 0.01f;
                }
            }
        }
Пример #22
0
        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();
            }
        }
Пример #24
0
        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();
            }
        }
Пример #25
0
 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);
     }
 }
Пример #26
0
        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();
            }
        }
Пример #27
0
        private void ButtonControls(GameTime gameTime)
        {
            if (!ControlManager.GamepadReady)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down))
                {
                    cursorIndex++;
                    holdTimer = game.HoldKeyTreshold;

                    PlayHoverSound();

                    if (cursorIndex > menuOptions.Length / 2 - 1)
                    {
                        cursorIndex = 0;
                    }
                }

                else if (ControlManager.CheckHold(RebindableKeys.Down))
                {
                    holdTimer -= gameTime.ElapsedGameTime.Milliseconds;

                    if (holdTimer <= 0)
                    {
                        cursorIndex++;
                        holdTimer = game.ScrollSpeedFast;

                        PlayHoverSound();
                    }

                    if (cursorIndex > menuOptions.Length / 2 - 1)
                    {
                        cursorIndex = menuOptions.Length / 2 - 1;
                    }
                }

                else if (ControlManager.CheckPress(RebindableKeys.Up))
                {
                    cursorIndex--;
                    holdTimer = game.HoldKeyTreshold;

                    PlayHoverSound();

                    if (cursorIndex < 0)
                    {
                        cursorIndex = menuOptions.Length / 2 - 1;
                    }
                }

                else if (ControlManager.CheckHold(RebindableKeys.Up))
                {
                    holdTimer -= gameTime.ElapsedGameTime.Milliseconds;

                    if (holdTimer <= 0)
                    {
                        cursorIndex--;
                        holdTimer = game.ScrollSpeedFast;

                        PlayHoverSound();
                    }

                    if (cursorIndex < 0)
                    {
                        cursorIndex = 0;
                    }
                }
            }

            else
            {
                if (ControlManager.CheckButtonPress(Buttons.DPadDown) ||
                    ControlManager.CheckButtonPress(Buttons.LeftThumbstickDown))
                {
                    cursorIndex++;
                    holdTimer = game.HoldKeyTreshold;

                    PlayHoverSound();
                }

                else if (ControlManager.CurrentGamepadState.IsButtonDown(Buttons.DPadDown) ||
                         ControlManager.CurrentGamepadState.IsButtonDown(Buttons.LeftThumbstickDown))
                {
                    holdTimer -= gameTime.ElapsedGameTime.Milliseconds;

                    if (holdTimer <= 0)
                    {
                        cursorIndex++;
                        holdTimer = game.ScrollSpeedFast;

                        PlayHoverSound();
                    }
                }

                else if (ControlManager.CheckButtonPress(Buttons.DPadUp) ||
                         ControlManager.CheckButtonPress(Buttons.LeftThumbstickUp))
                {
                    cursorIndex--;
                    holdTimer = game.HoldKeyTreshold;

                    PlayHoverSound();
                }

                else if (ControlManager.CurrentGamepadState.IsButtonDown(Buttons.DPadUp) ||
                         ControlManager.CurrentGamepadState.IsButtonDown(Buttons.LeftThumbstickUp))
                {
                    holdTimer -= gameTime.ElapsedGameTime.Milliseconds;

                    if (holdTimer <= 0)
                    {
                        cursorIndex--;
                        holdTimer = game.ScrollSpeedFast;

                        PlayHoverSound();
                    }
                }

                if (cursorIndex < 0)
                {
                    if (ControlManager.CurrentGamepadState.IsButtonUp(Buttons.DPadUp))
                    {
                        cursorIndex = menuOptions.Length / 2 - 1;
                    }
                    else if (ControlManager.CurrentGamepadState.IsButtonUp(Buttons.LeftThumbstickUp))
                    {
                        cursorIndex = menuOptions.Length / 2 - 1;
                    }
                    else
                    {
                        cursorIndex = 0;
                    }
                }

                else if (cursorIndex > menuOptions.Length / 2 - 1)
                {
                    if (ControlManager.CurrentGamepadState.IsButtonUp(Buttons.DPadDown))
                    {
                        cursorIndex = 0;
                    }
                    else if (ControlManager.CurrentGamepadState.IsButtonUp(Buttons.LeftThumbstickUp))
                    {
                        cursorIndex = 0;
                    }
                    else
                    {
                        cursorIndex = menuOptions.Length / 2 - 1;
                    }
                }
            }


            if (ControlManager.CheckPress(RebindableKeys.Action2) ||
                ControlManager.CheckPress(RebindableKeys.Pause))
            {
                optionsMenuState.LeaveSubState();
                OnLeave();
            }

            else if (ControlManager.CheckPress(RebindableKeys.Action1) ||
                     ControlManager.CheckKeyPress(Keys.Enter))
            {
                ButtonActions();
            }
        }
Пример #28
0
        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]));
        }
Пример #29
0
        private void CheckKeysCursorLevel2()
        {
            if (cursorLevel1Position == 0)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;

                    if (cursorLevel2Position > MissionManager.ReturnActiveMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnActiveMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnActiveMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }

            else if (cursorLevel1Position == 1)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;
                    if (cursorLevel2Position > MissionManager.ReturnCompletedDeadMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnCompletedDeadMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnCompletedDeadMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }

            else if (cursorLevel1Position == 2)
            {
                if (ControlManager.CheckPress(RebindableKeys.Down) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position += 1;
                    if (cursorLevel2Position > MissionManager.ReturnFailedDeadMissions().Count)
                    {
                        cursorLevel2Position = 0;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Up) && elapsedSinceKey > 100)
                {
                    cursorLevel2Position -= 1;
                    if (cursorLevel2Position < 0)
                    {
                        cursorLevel2Position = MissionManager.ReturnFailedDeadMissions().Count;
                    }

                    elapsedSinceKey = 0;
                }

                if ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter)) &&
                    elapsedSinceKey > 100)
                {
                    int missionCount = MissionManager.ReturnFailedDeadMissions().Count;

                    if (missionCount > 0 &&
                        cursorLevel2Position == missionCount)
                    {
                        cursorLevel = 1;
                    }

                    elapsedSinceKey = 0;
                }

                if (ControlManager.CheckPress(RebindableKeys.Action2) && elapsedSinceKey > 100)
                {
                    cursorLevel     = 1;
                    elapsedSinceKey = 0;
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            #region Input

            if (ControlManager.CheckHold(RebindableKeys.Up))
            {
                txtSpeed += 0.01f;
            }

            else
            {
                txtSpeed -= 0.01f;
            }

            if (ControlManager.GamepadReady == false)
            {
                if (ControlManager.CheckPress(RebindableKeys.Action1) ||
                    ControlManager.CheckKeyPress(Keys.Enter))
                {
                    Game.stateManager.ChangeState("OverworldState");
                }
            }

            if (ControlManager.GamepadReady == true)
            {
                if (ControlManager.CurrentGamepadState.IsButtonDown(ControlManager.GamepadAction))
                {
                    Game.stateManager.ChangeState("OverworldState");
                }
            }

            #endregion

            textBox.Update(gameTime);
            textBox.TextBoxPosY -= txtSpeed;

            if (txtSpeed > txtMaxSpeed)
            {
                txtSpeed = txtMaxSpeed;
            }

            else if (txtSpeed < txtMinSpeed)
            {
                txtSpeed = txtMinSpeed;
            }

            if (textBox.TextBoxPosY < 325)
            {
                Game.stateManager.ChangeState("OverworldState");
            }

            for (int i = 0; i < NumberOfStars; i++)
            {
                starPositions[i].X += (starSpeed * starSpeedModifiers[i]) * gameTime.ElapsedGameTime.Milliseconds;

                int returnValue = StaticFunctions.IsPositionOutsideScreenX(starPositions[i], Game);

                if (returnValue == 2)
                {
                    starPositions[i] = new Vector2(-30, (float)Game.random.Next(0, Game1.ScreenSize.Y));
                }
            }
        }