Beispiel #1
0
        private void EnterCheck()
        {
            for (int i = 0; i < gameObjects.Count; i++)
            {
                if (CollisionDetection.IsRectInRect(game.player.Bounds, gameObjects[i].Bounds))
                {
                    // TODO Repair the ship. Temporary solution.
                    StatsManager.RepairShip(StatsManager.Armor());

                    if (gameObjects[i] is Planet)
                    {
                        if (gameObjects[i].name.Equals("Highfence"))
                        {
                            Mission mission = MissionManager.GetMission(MissionID.Main8_1_BeginningOfTheEnd);

                            if (mission.MissionState == StateOfMission.Active)
                            {
                                if (mission.ObjectiveIndex != 0)
                                {
                                    game.stateManager.planetState.LoadPlanetData((Planet)gameObjects[i]);
                                    game.stateManager.ChangeState("PlanetState");
                                }
                            }
                            else
                            {
                                game.stateManager.planetState.LoadPlanetData((Planet)gameObjects[i]);
                                game.stateManager.ChangeState("PlanetState");
                            }
                        }

                        else
                        {
                            game.stateManager.planetState.LoadPlanetData((Planet)gameObjects[i]);
                            game.stateManager.ChangeState("PlanetState");
                        }
                    }

                    else if (gameObjects[i] is Station)
                    {
                        game.stateManager.stationState.LoadStationData((Station)gameObjects[i]);
                        game.stateManager.ChangeState("StationState");
                    }

                    else if (gameObjects[i] is Beacon)
                    {
                        ((Beacon)gameObjects[i]).Interact();
                    }

                    else if (gameObjects[i] is SubInteractiveObject)
                    {
                        ((SubInteractiveObject)gameObjects[i]).Interact();
                    }

                    else if (gameObjects[i] is OverworldShip)
                    {
                        ((OverworldShip)gameObjects[i]).Interact();
                    }
                }
            }
        }
        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();
            }
        }
        public override void Initialize()
        {
            base.Initialize();

            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message1Time, MissionManager.GetMission(MissionID.Main1_1_RebelsInTheAsteroids).GetEvent(Message1).Text, PortraitID.AllianceCaptain));
            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message2Time, MissionManager.GetMission(MissionID.Main1_1_RebelsInTheAsteroids).GetEvent(Message2).Text, PortraitID.AllianceCaptain));
        }
Beispiel #4
0
        public override void Initialize()
        {
            base.Initialize();

            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message1Time, MissionManager.GetMission(MissionID.Main7_Information).GetEvent(Message1Index).Text, PortraitID.RebelTroopLeader));
        }
        private void UpdateTutorialMessages(GameTime gameTime)
        {
            if (!hasEnteredStation && GameStateManager.currentState.Equals("StationState") &&
                game.stateManager.stationState.SubStateManager.ButtonControl == ButtonControl.Menu)
            {
                hasEnteredStation = true;
                DisplayTutorialMessage("You can disable tutorial messages in the options menu.", TutorialImage.MenuControls);
            }

            if (!hasEnteredOverworld && GameStateManager.currentState.Equals("OverworldState"))
            {
                tempTimer -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer < 0)
                {
                    tempTimer           = 50;
                    hasEnteredOverworld = true;

                    DisplayTutorialImage(TutorialImage.OverworldControls);
                }
            }

            else if (!coordinatesDisplayed &&
                     hasEnteredOverworld &&
                     PopupHandler.TextBufferEmpty)
            {
                coordinatesDisplayed = true;

                DisplayTutorialMessage("Your current objective is to go to coordinates (2450, 700). To find that location, follow the blinking dot on your radar. Main missions are represented by gold-colored dots and secondary missions by silver-colored dots.",
                                       TutorialImage.Radar);
            }

            Vector2 highfenceBeaconPosition = game.stateManager.overworldState.GetBeacon("Highfence Beacon").position;

            if (!hasEnteredHighfenceBeaconArea &&
                Vector2.Distance(game.player.position, highfenceBeaconPosition) < BeaconTutorialActivationRadius)
            {
                hasEnteredHighfenceBeaconArea = true;
                DisplayTutorialMessage("This is a 'beacon'. Beacons are used for traveling quickly between planets, but they need to be activated before use. Activate a beacon by flying close to it!");
            }

            if (!hasEnteredVerticalShooter && GameStateManager.currentState.Equals("ShooterState"))
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasEnteredVerticalShooter = true;
                    DisplayTutorialMessage(new List <String> {
                        "You can rebind the keys in the options menu.",
                        "Down at the bottom-left you can find information about the current level objective, your active weapons and on your ship's health, energy and shields."
                    },
                                           new List <TutorialImage> {
                        TutorialImage.CombatControls, TutorialImage.CombatBars
                    },
                                           new List <int> {
                        1
                    });
                }
            }

            if (!hasEnteredShooterWithShield && !(ShipInventoryManager.equippedShield is EmptyShield) &&
                GameStateManager.currentState.Equals("ShooterState"))
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasEnteredShooterWithShield = true;
                    DisplayTutorialMessage("You now have a shield to protect your ship's hull! If you take a hit, the shield will absorb the damage if it has enough power.");
                }
            }

            if (equipShieldTutorial &&
                !equipShieldTutorialFinished)
            {
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip = false;
                switch (equipShieldProgress)
                {
                case 0:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop"))
                    {
                        string message = "[Alliance Pilot] \"Start by selecting 'Buy/Sell' and pressing 'Enter'.";

                        if (!hasRecievedTutorialMoney)
                        {
                            message += " Here is two hundred Crebits, it should cover the cost for the shield.\"";
                        }

                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, message);

                        if (!hasRecievedTutorialMoney)
                        {
                            StatsManager.Crebits += 200;
                            PopupHandler.DisplayMessage("You recieved 200 Crebits.");
                            hasRecievedTutorialMoney = true;
                        }

                        equipShieldProgress = 1;
                    }
                    break;

                case 1:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop") &&
                        game.stateManager.stationState.SubStateManager.ActiveMenuState.Equals(game.stateManager.stationState.SubStateManager.ShopMenuState))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Select the 'Basic shield' in the column to the right and select 'Buy'.\"");
                        equipShieldProgress = 2;
                    }
                    break;

                case 2:
                    if (GameStateManager.currentState.Equals("StationState") &&
                        game.stateManager.stationState.Station.name.Equals("Highfence Shop") &&
                        game.stateManager.stationState.SubStateManager.ActiveMenuState.Equals(game.stateManager.stationState.SubStateManager.ShopMenuState) &&
                        ShipInventoryManager.ownedShields.Count > 0)
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Good! Now exit the shop by selecting and pressing 'Go Back' and return to the overworld!\"");
                        equipShieldProgress = 3;
                    }
                    break;

                case 3:
                    if (GameStateManager.currentState.Equals("OverworldState"))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Now, press 'I' to access your inventory.\"");
                        equipShieldProgress = 4;
                    }
                    break;

                case 4:
                    if (GameStateManager.currentState.Equals("ShipManagerState"))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"To equip your shield, select the shield slot and press 'Enter' to select from your list of available shields.\"");
                        equipShieldProgress = 5;
                    }
                    break;

                case 5:
                    if (GameStateManager.currentState.Equals("ShipManagerState") &&
                        game.stateManager.shipManagerState.IsShieldSlotSelected)
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Now, press 'Enter' again to equip the selected shield.\"");
                        equipShieldProgress = 6;
                    }
                    break;

                case 6:
                    if (!(ShipInventoryManager.equippedShield is EmptyShield))
                    {
                        PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "[Alliance Pilot] \"Good! Now your shield is equipped! What parts you have equipped is crucial for your success. Come back here often and try different combinations of ship parts.\"#\"Now, exit the inventory by pressing 'Escape' and return to me!\"");
                        equipShieldTutorialFinished = true;
                    }
                    break;
                }

                if (equipShieldProgress < 2 &&
                    ShipInventoryManager.OwnedShields.Count > 0)
                {
                    PopupHandler.DisplayPortraitMessage(PortraitID.AlliancePilot, "You already bought a shield? Okay, let me tell you how to equip it! Start by pressing 'I' to access your inventory.");
                    equipShieldProgress = 4;
                }
            }

            if (equipShieldTutorialFinished &&
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip == false)
            {
                game.stateManager.stationState.SubStateManager.ShopMenuState.DisplayBuyAndEquip = true;
            }

            if (ShipInventoryManager.HasItemOfKind("LongShot") &&
                MissionManager.GetMission(MissionID.Main3_DefendColony).MissionState.Equals(StateOfMission.Unavailable) &&
                GameStateManager.currentState.Equals("OverworldState") && !longShotTutorialActivated)
            {
                tempTimer3 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer3 <= 0)
                {
                    tempTimer3 = 1000;
                    longShotTutorialActivated = true;
                    DisplayTutorialMessage(new List <string>()
                    {
                        String.Format("You have recieved your first long-range weapon: 'LongShot'. You can have two weapons equipped at a time, and you can toggle between them in combat using '{0}'.", ControlManager.GetKeyName(RebindableKeys.Action2)),
                        "Try accessing your inventory with 'I' and equip LongShot on one slot and SpreadBullet on the other. Then you can vary your strategy in combat depending on which enemies you encounter."
                    });
                }
            }

            if (ShipInventoryManager.OwnedSecondary.Count > 0 && GameStateManager.currentState.Equals("OverworldState") &&
                !secondaryWeaponTutorialDisplayed)
            {
                tempTimer3 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer3 <= 0)
                {
                    tempTimer3 = 1000;
                    secondaryWeaponTutorialDisplayed = true;
                    DisplayTutorialMessage("You have acquired your first secondary weapon! Don't forget to equip it if you havn't done so already. Secondary weapons are fired automatically and don't use energy, so they are very handy!");
                }
            }

            if (isAMissionFailed && GameStateManager.currentState.Equals("OverworldState") &&
                !hasDisplayedSkipMessage)
            {
                tempTimer2 -= gameTime.ElapsedGameTime.Milliseconds;

                if (tempTimer2 < 0)
                {
                    tempTimer2 = 500;

                    hasDisplayedSkipMessage = true;
                    DisplayTutorialMessage("When you fail a mission, you can replay most of them by going back to where they started. Press 'Escape' to skip dialogs and mission events you have already seen.");
                }
            }
        }
        public override void Initialize()
        {
            base.Initialize();

            untriggeredEvents.Add(new SimpleMessageVertical(Game, player, spriteSheet, this, Message1Time, MissionManager.GetMission(MissionID.Main4_Infiltration).GetEvent(Message1Index).Text, PortraitID.AllianceCaptain));
        }