Example #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();
                    }
                }
            }
        }
        public LevelTesterState(Game1 game, string name) :
            base(game, name)
        {
            lifeFactor  = 1;
            initialLife = StatsManager.Armor();

            smallFont = game.Content.Load <SpriteFont>("Fonts/Iceland_12");

            display1.Add("Press Enter to start chosen level");
            display1.Add("Press Escape to return to main menu");
            display1.Add("Use number keys (0-9) to switch equipment");

            var missionPathDict = ShooterState.GetMissionPathDict();

            johansLevelEntries.Add(new LevelTesterEntry(missionPathDict["1_1"], Keys.Z, standardEquip: 1));
            johansLevelEntries.Add(new LevelTesterEntry(missionPathDict["2_1"], Keys.X, standardEquip: 2));
            johansLevelEntries.Add(new LevelTesterEntry(missionPathDict["2_2"], Keys.C, standardEquip: 2));
            johansLevelEntries.Add(new LevelTesterEntry(missionPathDict["3_1"], Keys.V, standardEquip: 3));
            johansLevelEntries.Add(new LevelTesterEntry(missionPathDict["3_2"], Keys.B, standardEquip: 3));

            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["4_1"], Keys.A, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["4_2"], Keys.S, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["5_1"], Keys.D, standardEquip: 5));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["5_2"], Keys.F, standardEquip: 5));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["6_1"], Keys.G, standardEquip: 6));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["6_2"], Keys.H, standardEquip: 6));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["7_1"], Keys.J, standardEquip: 6));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8o_1"], Keys.K, standardEquip: 7));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8o_2"], Keys.L, standardEquip: 7));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8r_1"], Keys.Q, standardEquip: 7));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8r_2"], Keys.W, standardEquip: 7));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8a_1"], Keys.E, standardEquip: 7));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["8a_2"], Keys.R, standardEquip: 7));

            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["rp1"], Keys.F1, standardEquip: 2));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["rp2"], Keys.F2, standardEquip: 2));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["rp3"], Keys.F3, standardEquip: 2));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["rp4"], Keys.F4, standardEquip: 2));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["rp5"], Keys.F5, standardEquip: 2));

            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["ap1"], Keys.F6, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["ap2"], Keys.F7, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["ap3"], Keys.F8, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["ap4"], Keys.F9, standardEquip: 4));
            jakobsLevelEntries.Add(new LevelTesterEntry(missionPathDict["ap5"], Keys.F10, standardEquip: 4));

            chosenLevel = jakobsLevelEntries[0].GetLevelEntry();
        }
Example #3
0
        public void Update(GameTime gameTime, List <GameObjectOverworld> visibleGameObjects)
        {
            radar.Update(gameTime, visibleGameObjects, game.camera.Position);

            lifeBar.Update(gameTime, StatsManager.GetShipLife(), StatsManager.Armor(),
                           new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 10,
                                       game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 15));

            int[] fusionCells = StatsManager.FusionCells;
            for (int i = 0; i < StatsManager.MaxFusionCells; i++)
            {
                fusionCellBars[i].Update(gameTime, fusionCells[i], 1,
                                         new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8,
                                                     game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 60 -
                                                     (i * 10)));
            }

            emergencyFusionCellBar.Update(gameTime, StatsManager.EmergencyFusionCell, 1,
                                          new Vector2(game.camera.cameraPos.X - Game1.ScreenSize.X / 2 + 8,
                                                      game.camera.cameraPos.Y + Game1.ScreenSize.Y / 2 - 45));

            autoSaveHandler.Update(gameTime);
        }
Example #4
0
        public CampaignState(Game1 game, string name) :
            base(game, name)
        {
            lifeFactor  = 1;
            initialLife = StatsManager.Armor();

            smallFont = game.Content.Load <SpriteFont>("Fonts/Iceland_12");
            bigFont   = game.Content.Load <SpriteFont>("Fonts/ISL_Jupiter_24");

            //display1.Add("Press Enter to start chosen level");
            //display1.Add("Press Escape to return to main menu");
            //display1.Add("Use number keys (0-9) to switch equipment");

            var jakobMissionPathDict = ShooterState.GetMissionPathDict();

            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["1_1"], Keys.A, standardEquip: 1));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["2_1"], Keys.A, standardEquip: 2));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["2_2"], Keys.A, standardEquip: 2));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["3_1"], Keys.A, standardEquip: 3));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["3_2"], Keys.A, standardEquip: 3));

            //campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["4_1"], "4 - Infiltration (1)", Keys.A, standardEquip: 4));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["4_2"], Keys.S, standardEquip: 4));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["5_1"], Keys.D, standardEquip: 5));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["5_2"], Keys.F, standardEquip: 5));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["6_1"], Keys.G, standardEquip: 6));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["6_2"], Keys.H, standardEquip: 6));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["7_1"], Keys.J, standardEquip: 6));

            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8o_1"], Keys.K, standardEquip: 7));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8o_2"], Keys.L, standardEquip: 7));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8r_1"], Keys.K, standardEquip: 7));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8r_2"], Keys.L, standardEquip: 7));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8a_1"], Keys.K, standardEquip: 7));
            campaignEntries.Add(new LevelTesterEntry(jakobMissionPathDict["8a_2"], Keys.L, standardEquip: 7));
        }
Example #5
0
        public override void Initialize()
        {
            base.Initialize();

            acceleration   = StatsManager.Acceleration();
            deAcceleration = StatsManager.Acceleration();

            maxSpeed = ShipInventoryManager.equippedPlating.Speed;

            playerShotHandler = new PlayerShotHandler(this, Game, spriteSheet);
            playerShotHandler.Initialize();

            Speed    = 0.0f;
            Position = new Vector2(Game1.ScreenSize.X / 2,
                                   Game1.ScreenSize.Y - Game.stateManager.shooterState.WindowHeightOffset - 75);
            IsKilled  = false;
            Direction = Vector2.Zero;

            HPmax = StatsManager.Armor();

            // If hardcore the life is fixed. Else, life is set to the ships armor.
            if (StatsManager.gameMode != GameMode.Hardcore)
            {
                HP = StatsManager.Armor();
            }
            else
            {
                HP = StatsManager.GetShipLife();
            }

            ShieldMax          = ShipInventoryManager.equippedShield.Capacity;
            Shield             = ShieldMax;
            conversionFactor   = ShipInventoryManager.equippedShield.ConversionFactor;
            shieldRegeneration = StatsManager.GetShieldRegeneration();

            MPmax       = ShipInventoryManager.equippedEnergyCell.Capacity;
            MP          = MPmax;
            MPtimer     = 0;
            MPgainedSec = StatsManager.GetEnergyRegeneration();

            ObjectClass       = "player";
            ObjectName        = "Player";
            TempInvincibility = 0;
            Damage            = 2000;
            DrawLayer         = 0.6f;

            lastTimeShotPrimary   = 10000;
            lastTimeShotSecondary = 10000;
            shootingDelay         = 300;

            //Animation
            anim.LoopTime = 1000;
            anim.AddFrame(spriteSheet.GetSubSprite(new Rectangle(216, 1, 23, 27)));

            shieldSprite = spriteSheet.GetSubSprite(new Rectangle(260, 100, 37, 37));

            BoundingSpace = 10;

            CenterPoint = new Vector2(anim.Width / 2, anim.Height / 2);
            angle       = (float)(Math.PI / 180) * 180;
        }