Exemple #1
0
        private void ButtonControls(GameTime gameTime)
        {
            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.ScrollSpeedSlow;

                    PlayHoverSound();
                }
            }

            else 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.ScrollSpeedSlow;

                    PlayHoverSound();
                }
            }

            if (buttonIndex > buttons.Count - 1)
            {
                if (ControlManager.PreviousKeyUp(RebindableKeys.Down))
                {
                    buttonIndex = 0;
                }
                else
                {
                    buttonIndex = buttons.Count - 1;
                }
            }

            else if (buttonIndex < 0)
            {
                if (ControlManager.PreviousKeyUp(RebindableKeys.Up))
                {
                    buttonIndex = buttons.Count - 1;
                }
                else
                {
                    buttonIndex = 0;
                }
            }

            activeButton = buttons[buttonIndex];

            foreach (MenuDisplayObject button in buttons)
            {
                button.isActive = false;
            }

            activeButton.isActive = true;

            if (ControlManager.CheckPress(RebindableKeys.Action1) ||
                ControlManager.CheckKeyPress(Keys.Enter))
            {
                ButtonActions();
            }

            // TODO: REMOVE FOR RELEASE VERSION
            //if (ControlManager.CheckKeyPress(Keys.M))
            //{
            //    Game.stateManager.ChangeState("LevelTesterState");
            //}

            if (ControlManager.CheckKeyHold(Keys.LeftAlt) &&
                ControlManager.CheckKeyPress(Keys.C))
            {
                Game.stateManager.ChangeState("CampaignState");
            }
        }
Exemple #2
0
        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;
                }
            }
        }
        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;
                }
            }
        }
        private void CheckMouseLevel2()
        {
            int    listLength;
            string text = "";

            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;
                }
            }

            for (int i = 0; i < listLength + 1; i++)
            {
                if (i < listLength)
                {
                    if (cursorCoordLv1.Position != 5)
                    {
                        if (cursorCoordLv1.Position == 1)
                        {
                            text = ShipInventoryManager.ownedEnergyCells[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 2)
                        {
                            text = ShipInventoryManager.ownedPlatings[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 3)
                        {
                            text = ShipInventoryManager.ownedShields[i].Name;
                        }
                        else if (cursorCoordLv1.Position == 4)
                        {
                            text = ShipInventoryManager.OwnedSecondary[i].Name;
                        }
                    }

                    else
                    {
                        if (cursorCoordLv1.Y == 0)
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(1)[i].Name;
                        }
                        else
                        {
                            text = ShipInventoryManager.GetAvailablePrimaryWeapons(2)[i].Name;
                        }
                    }
                }
                else
                {
                    text = "Back";
                }

                if (ControlManager.IsMouseOverText(FontManager.GetFontStatic(16), text,
                                                   new Vector2(Game1.ScreenSize.X / 2 + 50, 93 + i * 23), Vector2.Zero, false))
                {
                    cursorLevel2Position = i;

                    if (ControlManager.IsLeftMouseButtonClicked())
                    {
                        if (cursorLevel2Position < listLength)
                        {
                            OnPressLevel2();
                        }
                        else
                        {
                            cursorLevel     = 1;
                            elapsedSinceKey = 0;
                        }
                    }
                }
            }
        }
Exemple #5
0
 public static bool IsMouseMoving()
 {
     return(ControlManager.GetMousePosition() != ControlManager.GetPreviousMousePosition());
 }
        private void DeveloperOptions()
        {
            if (ControlManager.CheckKeyPress(Keys.D1))
            {
                Game.stateManager.shooterState.BeginLevel("flightTraining_1");
            }

            if (ControlManager.CheckKeyPress(Keys.D2))
            {
                Game.stateManager.shooterState.BeginLevel("flightTraining_2");
            }

            if (ControlManager.CheckKeyPress(Keys.D3))
            {
                Game.stateManager.shooterState.BeginLevel("flightTraining_3");
            }

            if (ControlManager.CheckKeyPress(Keys.D0))
            {
                Game.stateManager.shooterState.BeginLevel("JakobDevelop");
            }

            if (ControlManager.CheckKeyPress(Keys.D9))
            {
                Game.stateManager.shooterState.BeginLevel("mapCreator2");
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad0))
            {
                ShipInventoryManager.ActivateCheatPrimary();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad1))
            {
                ShipInventoryManager.ActivateCheatSecondary();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad2))
            {
                ShipInventoryManager.ActivateCheatEnergy();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad3))
            {
                ShipInventoryManager.ActivateCheatShield();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad4))
            {
                ShipInventoryManager.ActivateCheatPlating();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad5))
            {
                ShipInventoryManager.ActivateCheatEquip1();
            }

            if (ControlManager.CheckKeyPress(Keys.NumPad6))
            {
                ShipInventoryManager.ActivateCheatEquip2();
            }
        }
Exemple #7
0
        protected override void Initialize()
        {
            CreateDirectories();
            SetAvailableResolutions();
            GameStarted = false;

            settingsFile = new SaveFile(this);
            settingsFile.Load(SaveFilePath, "settings.ini");

            Vector2 defaultResolution = GetDefaultResolution();

            resolution = new Vector2(settingsFile.GetPropertyAsFloat("visual", "resolutionx", defaultResolution.X),
                                     settingsFile.GetPropertyAsFloat("visual", "resolutiony", defaultResolution.Y));
            ScreenSize = new Point((int)resolution.X, (int)resolution.Y);

            random = new Random(DateTime.Now.Millisecond);

            showFPS = settingsFile.GetPropertyAsBool("visual", "showfps", false);

            graphics.PreferredBackBufferWidth  = (int)resolution.X;
            graphics.PreferredBackBufferHeight = (int)resolution.Y;
            if (IsDualMonitor())
            {
                graphics.IsFullScreen = false;
            }
            else
            {
                graphics.IsFullScreen = settingsFile.GetPropertyAsBool("visual", "fullscreen", true);
            }
            graphics.SynchronizeWithVerticalRetrace = true;

            // Uncomment to unlock FPS
            //IsFixedTimeStep = false;
            //graphics.SynchronizeWithVerticalRetrace = false;

            graphics.ApplyChanges();

            CenterScreenWindow();

            IsMouseVisible = settingsFile.GetPropertyAsBool("game options", "showmouse", true);

            menuBGController = new MenuBackdropController(this);
            menuBGController.Initialize();

            musicManager = new MusicManager(this);
            musicManager.Initialize();

            soundEffectsManager = new SoundEffectsManager(this);
            soundEffectsManager.Initialize();

            fontManager = new FontManager(this);
            fontManager.Initialize();

            ControlManager.LoadControls(settingsFile);

            spriteSheetOverworld       = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/smallObjectSpriteSheet"));
            spriteSheetVerticalShooter = new Sprite(Content.Load <Texture2D>("Vertical-Sprites/shooterSheet"));
            messageBoxSpriteSheet      = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/messageBoxSpriteSheet"));
            spriteSheetItemDisplay     = new Sprite(Content.Load <Texture2D>("itemVisualSheet"));
            beaconMenuSprite           = new Sprite(Content.Load <Texture2D>("Overworld-Sprites/BeaconMenu"));
            CollisionHandlingOverWorld.LoadLineTexture(this);

            shipInventoryManager = new ShipInventoryManager(this);
            shipInventoryManager.Initialize();

            statsManager = new StatsManager(this);
            statsManager.Initialize();

            player = new PlayerOverworld(this, spriteSheetOverworld);
            player.Initialize();

            beaconMenu = new BeaconMenu(this, beaconMenuSprite);
            beaconMenu.Initialize();

            stateManager = new GameStateManager(this);
            stateManager.Initialize();

            missionManager = new MissionManager(this);
            missionManager.Initialize();

            tutorialManager = new TutorialManager(this);
            tutorialManager.Initialize();
            tutorialManager.TutorialsUsed = settingsFile.GetPropertyAsBool("game options", "tutorials", true);

            shopManager = new ShopManager();

            saveFile = new SaveFile(this);

            Portrait.InitializePortraitSpriteSheet(this);
            popupHandler = new PopupHandler(this, messageBoxSpriteSheet);
            popupHandler.Initialize();

            helper = new HelperBox(this);

            ShopManager.SetShopUpdateTime(ShopManager.PRESET_SHOPTIME);

            base.Initialize();
        }
Exemple #8
0
        private void PlayerMovement(GameTime gameTime)
        {
            if (speed > maxSpeed)
            {
                speed = maxSpeed;
            }

            else if (speed < -maxSpeed)
            {
                speed = -maxSpeed;
            }

            if (StatsManager.Fuel >= normalFuelCost)
            {
                if (ControlManager.CheckHold(RebindableKeys.Action3) &&
                    isHyperSpeedUnlocked &&
                    !isDevelopSpeedUnlocked &&
                    controlsEnabled)
                {
                    maxSpeed     = boostSpeed;
                    turningSpeed = boostTurningSpeed;
                    playerAcc    = commonAcc;
                    usingBoost   = true;
                }

                else if (ControlManager.CheckHold(RebindableKeys.Action3) &&
                         isDevelopSpeedUnlocked &&
                         controlsEnabled)
                {
                    maxSpeed     = developSpeed;
                    turningSpeed = boostTurningSpeed;
                    playerAcc    = developAcc;
                    usingBoost   = true;
                }

                else
                {
                    maxSpeed     = commonSpeed;
                    turningSpeed = commonTurningSpeed;
                    playerAcc    = commonAcc;
                    usingBoost   = false;
                }
            }

            if (ControlManager.CheckHold(RebindableKeys.Up) && controlsEnabled)
            {
                if (StatsManager.Fuel > normalFuelCost)
                {
                    if (ControlManager.GamepadReady && ControlManager.ThumbStickAngleY != 0)
                    {
                        if (StatsManager.Fuel > normalFuelCost)
                        {
                            speed += playerAcc * MathFunctions.FPSSyncFactor(gameTime);
                        }

                        AddParticle();
                    }
                    else
                    {
                        if (StatsManager.Fuel > normalFuelCost)
                        {
                            speed += playerAcc * MathFunctions.FPSSyncFactor(gameTime);
                        }

                        AddParticle();

                        Game.soundEffectsManager.PlaySoundEffect(SoundEffects.OverworldEngine, 0f, 0f);
                    }
                }
            }

            if (ControlManager.CheckHold(RebindableKeys.Right) && controlsEnabled)
            {
                if (StatsManager.Fuel > normalFuelCost)
                {
                    Direction.SetDirection(Direction.GetDirectionAsDegree() + turningSpeed * MathFunctions.FPSSyncFactor(gameTime));
                }
            }

            else if (ControlManager.CheckHold(RebindableKeys.Left) &&
                     controlsEnabled)
            {
                if (StatsManager.Fuel > normalFuelCost)
                {
                    Direction.SetDirection(Direction.GetDirectionAsDegree() - turningSpeed * MathFunctions.FPSSyncFactor(gameTime));
                }
            }

            if (!ControlManager.CheckHold(RebindableKeys.Up) && controlsEnabled)
            {
                if (speed > 0)
                {
                    speed -= playerAcc * MathFunctions.FPSSyncFactor(gameTime);
                }

                else if (speed <= 0)
                {
                    speed = 0;
                }

                Game.soundEffectsManager.FadeOutSoundEffect(SoundEffects.OverworldEngine);
            }

            angle = (float)(MathFunctions.RadiansFromDir(new Vector2(
                                                             Direction.GetDirectionAsVector().X, Direction.GetDirectionAsVector().Y)) + (Math.PI * 90) / 180);
        }
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (autofollow && started)
            {
                if (!escortDataCapsule.ShipToDefend.HasArrived)
                {
                    game.player.Direction.SetDirection(new Vector2(
                        escortDataCapsule.ShipToDefend.destination.X - game.player.position.X,
                        escortDataCapsule.ShipToDefend.destination.Y - game.player.position.Y));
                }

                game.player.speed = escortDataCapsule.ShipToDefend.speed;

                if (ControlManager.CheckPress(RebindableKeys.Pause)
                    && GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                        new List<string>() { "Yes", "No" },
                        new List<System.Action>(){
                            delegate 
                            {
                                SkipForward();
                            },
                            delegate {}
                        });
                }
            }

            if (timedMessageCount >= 0
                && timedMessageCount < timedMessages.Count
                && StatsManager.PlayTime.HasOverworldTimePassed(timedMessageTimes[timedMessageCount]))
            {
                if (timedMessagePortraits[timedMessageCount] != PortraitID.None)
                {
                    PopupHandler.DisplayRealtimePortraitMessage(3000, new [] {timedMessagePortraits[timedMessageCount]},
                        new List<int>(), timedMessages[timedMessageCount]);
                }
                else
                {
                    PopupHandler.DisplayRealtimeMessage(3000, timedMessages[timedMessageCount]);
                }
                timedMessageCount++;
            }

            // Player talks to freighter to begin escort
            if (!started
                && GameStateManager.currentState.Equals("OverworldState")
                && CollisionDetection.IsRectInRect(game.player.Bounds, escortDataCapsule.ShipToDefend.Bounds)
                && ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter))))
            {
                if (showInventoryTutorial
                    && ShipInventoryManager.equippedShield is EmptyShield)
                {
                    PopupHandler.DisplayPortraitMessage(introductionPortrait, "[Alliance Pilot] \"You need to equip a shield before we leave. Go to the shop next to Highfence and I will tell you what to do.");
                    game.tutorialManager.EnableEquipTutorial();
                }

                else
                {
                    if (introductionPortrait != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(introductionPortrait, introductionText);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(introductionText);
                    }

                    ((FreighterShip)escortDataCapsule.ShipToDefend).Start();
                    escortDataCapsule.ShipToDefend.speed = escortDataCapsule.FreighterSpeed;

                    started = true;

                    if (autofollow)
                    {
                        game.player.DisableControls();
                    }

                    this.Description = descriptions[0];

                    enemyAttackStartTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackStartTime);

                    for (int i = 0; i < timedMessages.Count; i++)
                    {
                        timedMessageTimes.Add(StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.TimedMessageTriggers[i]));
                    }
                    timedMessageCount = 0;
                }
            }

            // Escort mission begins
            if (started 
                && GameStateManager.currentState.Equals("OverworldState") &&
                numberOfEnemyShips > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(enemyAttackStartTime))
            {
                // Ready to spawn a new enemy ship
                if (StatsManager.PlayTime.HasOverworldTimePassed(enemyNextWaveTime))
                {
                    int i = startingNumberOfEnemyShips - numberOfEnemyShips;

                    if (descriptions.Count > 0)
                    {
                        if (descriptions.Count > 1)
                        {
                            descriptions.RemoveAt(0);
                        }

                        this.Description = descriptions[0];
                    }

                    if (attackStartPortraits[i] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(attackStartPortraits[i], attackStartText[i]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(attackStartText[i]);
                    }

                    game.stateManager.overworldState.GetSectorX.shipSpawner.AddOverworldShip(
                        enemies[0],
                        escortDataCapsule.ShipToDefend.position +
                        (650 * escortDataCapsule.ShipToDefend.Direction.GetDirectionAsVector()),
                        levels[levelIndex], escortDataCapsule.ShipToDefend);

                    numberOfEnemyShips--;

                    if (numberOfEnemyShips > 0)
                    {
                        enemyNextWaveTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackFrequency);
                    }
                }
            }
            
            // Transfers freigter hp between levels
            for (int i = 0; i < levels.Count; i++)
            {
                if (GameStateManager.currentState.Equals("ShooterState")
                    && game.stateManager.shooterState.CurrentLevel.Identifier.Equals(levels[i])
                    && game.stateManager.shooterState.GetLevel(levels[i]).IsObjectiveCompleted)
                {
                    shipToDefendHP = game.stateManager.shooterState.CurrentLevel.GetFreighterHP();

                    levelCompleted = true;
                    levelCompletedIndex = i;
                    levelIndex = i + 1;
                }
            }

            if (GameStateManager.currentState.Equals("OverworldState"))
            {
                if (levelCompleted
                && levelCompletedIndex > lastLevelCompletedIndex)
                {
                    levelCompleted = false;
                    lastLevelCompletedIndex = levelCompletedIndex;

                    if (afterAttackPortraits[levelCompletedIndex] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(afterAttackPortraits[levelCompletedIndex],
                            afterAttackMessages[levelCompletedIndex]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(afterAttackMessages[levelCompletedIndex]);
                    }
                }
                else
                {
                    levelCompleted = false;
                }
            }

            Collision();
        }
Exemple #10
0
        public override void ButtonActions()
        {
            switch (menuOptions[cursorIndex, 0].ToLower())
            {
            case "control type:":
            {
                if (menuOptions[0, 1] == "Gamepad")
                {
                    menuOptions[0, 1]         = "Keyboard";
                    ControlManager.UseGamepad = false;
                    ResetMenuOptions(true);
                }
                else
                {
                    if (ControlManager.GamepadReady)
                    {
                        menuOptions[0, 1]         = "Gamepad";
                        ControlManager.UseGamepad = true;
                        ResetMenuOptions(false);
                    }
                }
            }
            break;

            case "action 1 / fire / confirm":
                InitInputCheck(RebindableKeys.Action1);
                break;

            case "action 2 / switch weapons / back":
                InitInputCheck(RebindableKeys.Action2);
                break;

            case "action 3":
                InitInputCheck(RebindableKeys.Action3);
                break;

            case "up":
                InitInputCheck(RebindableKeys.Up);
                break;

            case "down":
                InitInputCheck(RebindableKeys.Down);
                break;

            case "left":
                InitInputCheck(RebindableKeys.Left);
                break;

            case "right":
                InitInputCheck(RebindableKeys.Right);
                break;

            case "pause / access menu":
                InitInputCheck(RebindableKeys.Pause);
                break;

            case "access inventory":
                InitInputCheck(RebindableKeys.Inventory);
                break;

            case "access map":
                InitInputCheck(RebindableKeys.Map);
                break;

            case "access mission log":
                InitInputCheck(RebindableKeys.Missions);
                break;

            case "access help screen":
                InitInputCheck(RebindableKeys.Help);
                break;

            case "reset default keys":
                ControlManager.SetDefaultControls();
                ResetMenuOptions(menuOptions[0, 1] == "Keyboard");

                PlaySelectSound();
                break;

            case "back":
                optionsMenuState.LeaveSubState();
                OnLeave();

                PlayLowPitchSelectSound();
                break;
            }
        }
        /// <summary>
        /// Updates map zooming
        /// </summary>
        /// <param name="gameObjects">Objects to be scaled up for visibility</param>
        public static void Update(GameTime gameTime, List <GameObjectOverworld> gameObjects, Camera camera)
        {
            ZoomMap.camera = camera;

            if (mapState == MapState.ZoomingOut)
            {
                camera.Zoom *= ZoomRate * gameTime.ElapsedGameTime.Milliseconds;

                if (camera.Zoom <= ZoomedOutValue)
                {
                    Game1.Paused = true;
                    mapState     = MapState.On;
                }
            }
            else if (mapState == MapState.ZoomingIn)
            {
                camera.Zoom *= (1 + (1 - (ZoomRate * gameTime.ElapsedGameTime.Milliseconds)));

                if (camera.Zoom >= 1f)
                {
                    HideMap(camera, gameObjects);
                }
            }

            else if (mapState == MapState.On &&
                     (ControlManager.CheckPress(RebindableKeys.Action2) ||
                      ControlManager.CheckKeyPress(Keys.Escape)))
            {
                mapState = MapState.ZoomingIn;
            }

            // Scale up objects
            foreach (GameObjectOverworld obj in gameObjects)
            {
                if ((obj is Planet ||
                     obj.name.ToLower().Equals("soelara") ||
                     obj.name.ToLower().Equals("lavis") ||
                     obj.name.ToLower().Equals("fortrun")) &&
                    camera.Zoom < PlanetZoomScale)
                {
                    obj.scale = PlanetZoomScale / camera.Zoom;
                }

                else if (obj is SystemStar &&
                         camera.Zoom < StarZoomScale)
                {
                    obj.scale = StarZoomScale / camera.Zoom;
                }

                else if ((obj is Station ||
                          obj.name.ToLower().Equals("fortrun station")) &&
                         camera.Zoom < StationZoomScale)
                {
                    obj.scale = StationZoomScale / camera.Zoom;
                }

                else if (obj is PlayerOverworld &&
                         camera.Zoom < PlayerZoomScale)
                {
                    obj.scale = PlayerZoomScale / camera.Zoom;
                }
            }
        }
        /// <summary>
        /// Draws names of all objects in gameObjects relative to their position
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="gameObjects">objects which names to be displayed</param>
        public static void DrawOverlay(SpriteBatch spriteBatch, List <GameObjectOverworld> gameObjects)
        {
            if (mapState == MapState.On)
            {
                foreach (GameObjectOverworld obj in gameObjects)
                {
                    spriteBatch.DrawString(FontManager.GetFontStatic(14), obj.name,
                                           new Vector2(obj.position.X, obj.position.Y - ((obj.Bounds.Height * obj.scale) / 2) - 300),
                                           Color.White, 0f,
                                           FontManager.GetFontStatic(14).MeasureString(obj.name) / 2,
                                           55, SpriteEffects.None, 1f);
                }

                spriteBatch.DrawString(FontManager.GetFontStatic(14), "Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..",
                                       new Vector2(camera.cameraPos.X, camera.cameraPos.Y + HelpTextOffset),
                                       Color.White, 0f,
                                       FontManager.GetFontStatic(14).MeasureString("Press '" + ControlManager.GetKeyName(RebindableKeys.Map) + "' to hide map..") / 2,
                                       80, SpriteEffects.None, 1f);
            }
        }
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            // Updates player direction and speed
            if (!HasAnyShipArrived())
            {
                game.player.Direction.SetDirection(new Vector2(
                                                       Destination.position.X - game.player.position.X,
                                                       Destination.position.Y - game.player.position.Y));

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }
            game.player.speed = speed;

            // Displays timed messages
            if (timedMessages.Keys.Count > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(nextMessageTime))
            {
                if (portraits.Count > 0)
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimePortraitMessage(GetNextMessageDuration(), portraits[0].ToArray(),
                                                                    portraitTriggers[0], timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayPortraitMessage(portraits[0], portraitTriggers[0], timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }

                    portraits.RemoveAt(0);
                    portraitTriggers.RemoveAt(0);
                }
                else
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimeMessage(GetNextMessageDuration(), timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayMessage(timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }
                }

                timedMessages.Remove(timedMessages.Keys.First());

                if (timedMessages.Keys.Count > 0)
                {
                    nextMessageTime = GetNextMessageStartTime();
                }
            }
        }
Exemple #14
0
        public void DrawEndMessage(SpriteBatch spriteBatch)
        {
            if (IsObjectiveCompleted)
            {
                spriteBatch.DrawString(font1, "Level Completed!\n\n" + EndText,
                                       new Vector2(Game1.ScreenSize.X / 2,
                                                   Game1.ScreenSize.Y / 2) + Game.fontManager.FontOffset,
                                       Game.fontManager.FontColor,
                                       0f,
                                       font1.MeasureString("Level Completed!\n\n" + EndText) / 2,
                                       1f,
                                       SpriteEffects.None,
                                       0.9f);
            }
            else if (IsObjectiveFailed || isLevelGivenUp)
            {
                String failText;
                if (!isPirateLevel)
                {
                    failText = String.Format("You are dead!\n\nPress 'R' to try again '{0}' to go back.", ControlManager.GetKeyName(RebindableKeys.Action2));
                }
                else
                {
                    failText = String.Format("You are dead! You lost {0} crebits.\n\nPress '{1}' to go back.", pirateLossPenaly, ControlManager.GetKeyName(RebindableKeys.Action2));
                }

                spriteBatch.DrawString(font1, failText,
                                       new Vector2(Game1.ScreenSize.X / 2,
                                                   Game1.ScreenSize.Y / 2) + Game.fontManager.FontOffset,
                                       Game.fontManager.FontColor,
                                       0f,
                                       font1.MeasureString(failText) / 2,
                                       1f,
                                       SpriteEffects.None,
                                       1f);
            }
        }
Exemple #15
0
        protected override void Update(GameTime gameTime)
        {
            Window.Title = "The Sun Will Go Out";
            //Window.Title = "Pos x: " + player.position.X + " Pos y: " + player.position.Y;

            if (IsActive)
            {
                ControlManager.Update(gameTime);

                //Toggles fullscreen on/off
                if (ControlManager.CurrentKeyboardState.IsKeyDown(Keys.LeftAlt) && ControlManager.CheckKeyPress(Keys.F))
                {
                    graphics.ToggleFullScreen();
                    graphics.ApplyChanges();
                }

                //Checks if the player should be used
                if (GameStateManager.currentState == "OverworldState" || GameStateManager.currentState == "System1State" ||
                    GameStateManager.currentState == "System2State" || GameStateManager.currentState == "System3State")
                {
                    player.IsUsed = true;
                }
                else
                {
                    player.IsUsed = false;
                }

                if (!Paused)
                {
                    if (player.IsUsed)
                    {
                        player.Update(gameTime);
                    }

                    stateManager.Update(gameTime);
                    missionManager.Update(gameTime);
                    tutorialManager.Update(gameTime);
                    shopManager.Update(gameTime);
                }

                else if (ZoomMap.IsMapOn)
                {
                    camera.CameraUpdate(gameTime, player);
                }

                soundEffectsManager.Update(gameTime);

                if (ControlManager.CheckPress(RebindableKeys.Map) &&
                    GameStateManager.currentState == "OverworldState" &&
                    !PopupHandler.IsMenuOpen)
                {
                    ZoomMap.ToggleMap();
                    soundEffectsManager.StopSoundEffect(SoundEffects.OverworldEngine);
                }

                if (ZoomMap.IsMapOn)
                {
                    ZoomMap.Update(gameTime, stateManager.overworldState.GetZoomObjects, camera);
                }

                popupHandler.Update(gameTime);
                helper.Update(gameTime);
                beaconMenu.Update(gameTime);

                fpsTimer -= gameTime.ElapsedGameTime.Milliseconds;
                if (fpsTimer <= 0)
                {
                    fps      = (float)Math.Round((1 / gameTime.ElapsedGameTime.TotalSeconds), 0);
                    fpsTimer = 250;
                }

                if (ControlManager.CurrentKeyboardState.IsKeyDown(Keys.LeftAlt) &&
                    ControlManager.CheckKeyPress(Keys.M))
                {
                    musicManager.SwitchMusicMuted();
                }

                menuBGController.Update(gameTime);

                base.Update(gameTime);
            }
        }
        private void PlayerMovement()
        {
            if (ControlManager.CheckHold(RebindableKeys.Left) && !ControlManager.CheckHold(RebindableKeys.Up) &&
                !ControlManager.CheckHold(RebindableKeys.Right) && !ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = -1.0f;
                DirectionY = 0;
                Speed     += acceleration;
            }

            if (!ControlManager.CheckHold(RebindableKeys.Left) && ControlManager.CheckHold(RebindableKeys.Up) &&
                !ControlManager.CheckHold(RebindableKeys.Right) && !ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = 0;
                DirectionY = -1.0f;
                Speed     += acceleration;
            }

            if (!ControlManager.CheckHold(RebindableKeys.Left) && !ControlManager.CheckHold(RebindableKeys.Up) &&
                ControlManager.CheckHold(RebindableKeys.Right) && !ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = 1.0f;
                DirectionY = 0;
                Speed     += acceleration;
            }

            if (!ControlManager.CheckHold(RebindableKeys.Left) && !ControlManager.CheckHold(RebindableKeys.Up) &&
                !ControlManager.CheckHold(RebindableKeys.Right) && ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = 0;
                DirectionY = 1.0f;
                Speed     += acceleration;
            }

            if (ControlManager.CheckHold(RebindableKeys.Left) && ControlManager.CheckHold(RebindableKeys.Up) &&
                !ControlManager.CheckHold(RebindableKeys.Right) && !ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = -1.0f;
                DirectionY = -1.0f;
                Speed     += acceleration;
            }

            if (ControlManager.CheckHold(RebindableKeys.Left) && !ControlManager.CheckHold(RebindableKeys.Up) &&
                !ControlManager.CheckHold(RebindableKeys.Right) && ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = -1.0f;
                DirectionY = 1.0f;
                Speed     += acceleration;
            }

            if (!ControlManager.CheckHold(RebindableKeys.Left) && ControlManager.CheckHold(RebindableKeys.Up) &&
                ControlManager.CheckHold(RebindableKeys.Right) && !ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = 1.0f;
                DirectionY = -1.0f;
                Speed     += acceleration;
            }

            if (!ControlManager.CheckHold(RebindableKeys.Left) && !ControlManager.CheckHold(RebindableKeys.Up) &&
                ControlManager.CheckHold(RebindableKeys.Right) && ControlManager.CheckHold(RebindableKeys.Down))
            {
                DirectionX = 1.0f;
                DirectionY = 1.0f;
                Speed     += acceleration;
            }
        }
        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]));
        }
        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);
            }
        }
Exemple #19
0
 public override void StartMission()
 {
     ReplaceObjectiveText(TextType.Event, ActionKeyID,
                          "'" + ControlManager.GetKeyName(RebindableKeys.Action2) + "'");
     missionHelper.ShowEvent(GetEvent((int)EventID.Introduction));
 }