Ejemplo n.º 1
0
        public InGameGUI(LevelState parent)
        {
            this.parent = parent;

            if (prices == null)
            {
                prices = new PriceDisplay[3];
            }

            for (int i = 0; i < windowIsActive.Length; i++)
            {
                windowIsActive[i] = false;
            }

            blackFadeOverlay = 0.0f;

            keyFoundPic    = AnimationLib.getFrameAnimationSet("keyPic");
            keyNotFoundPic = AnimationLib.getFrameAnimationSet("keyEmptyPic");

            coinAnim     = AnimationLib.getFrameAnimationSet("testCoin");
            medAnim      = AnimationLib.getFrameAnimationSet("itemHealth");
            ammoAnim     = AnimationLib.getFrameAnimationSet("itemBattery");
            arrowPointer = AnimationLib.getFrameAnimationSet("compassArrow");

            mapIcon = TextureLib.getLoadedTexture("mapPda.png");

            testWin = new BoxWindow("foo", 100, 100, 200, "GamePad code overflowing with madness");

            flickerTime      = 0.0f;
            playerOutOfSight = false;
        }
Ejemplo n.º 2
0
            public FrameAnimationSet(SerializableAnimationData data)
            {
                x             = data.initalX;
                y             = data.initalY;
                offsetX       = data.offsetX;
                offsetY       = data.offsetY;
                frameWidth    = data.frameWidth;
                frameHeight   = data.frameHeight;
                frameCount    = data.frameCount;
                frameDuration = data.frameSpeed;
                loop          = data.loop;

                sheet = TextureLib.getLoadedTexture(data.sheetName);
            }
        public LevelSelectState()
        {
            //GameCampaign.levelMap = new LevelData[6, 3];

            wireframe = TextureLib.getLoadedTexture("shipWireframe.png");

            PresentationParameters pp = AnimationLib.GraphicsDevice.PresentationParameters;

            textureScreen        = new RenderTarget2D(AnimationLib.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, AnimationLib.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24);
            halfTextureScreen    = new RenderTarget2D(AnimationLib.GraphicsDevice, pp.BackBufferWidth / 2, pp.BackBufferHeight / 2, false, AnimationLib.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24);
            quarterTextureScreen = new RenderTarget2D(AnimationLib.GraphicsDevice, pp.BackBufferWidth / 4, pp.BackBufferHeight / 4, false, AnimationLib.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24);
            sb2 = new SpriteBatch(AnimationLib.GraphicsDevice);

            /*
             * for (int i = 0; i < GameCampaign.levelMap.GetLength(0); i++)
             * {
             *  for (int j = 0; j < GameCampaign.levelMap.GetLength(1); j++)
             *  {
             *      GameCampaign.levelMap[i, j] = new LevelData(Game1.rand.NextDouble(), Game1.rand.NextDouble(), Game1.rand.NextDouble(), Game1.rand.NextDouble());
             *  }
             * }
             *
             * GameCampaign.levelMap[0, 0].visible = false;
             * GameCampaign.levelMap[0, 2].visible = false;
             * GameCampaign.levelMap[GameCampaign.levelMap.GetLength(0) - 1, 0].visible = false;
             * GameCampaign.levelMap[GameCampaign.levelMap.GetLength(0) - 1, 2].visible = false;
             */

            selectedLevelX = GameCampaign.PlayerLevelProgress + 1;
            selectedLevelY = GameCampaign.PlayerFloorHeight;

            cursorPosition      = new Vector2(((GameCampaign.PlayerLevelProgress * 128) + drawMapTestOffset.X), ((GameCampaign.PlayerFloorHeight * 96) + drawMapTestOffset.Y));
            cursorAnimationTime = 0;

            state = LevelSelectStateState.AnimateIn;

            openingSoundMade = false;
        }
Ejemplo n.º 4
0
        private void loadContent2()
        {
#if XBOX
            Thread.CurrentThread.SetProcessorAffinity(3);
#endif
            backGroundPic   = Content.Load <Texture2D>("titleScreenPic");
            frostTreeLogo   = Content.Load <Texture2D>("FrostTreeLogo");
            testArrow       = Content.Load <Texture2D>("gfx/testArrow");
            laserPic        = Content.Load <Texture2D>("gfx/laser");
            healthBar       = Content.Load <Texture2D>("bg");
            healthColor     = Content.Load <Texture2D>("healthTexture");
            energyColor     = Content.Load <Texture2D>("ammoTexture");
            energyOverlay   = Content.Load <Texture2D>("overlay");
            popUpBackground = Content.Load <Texture2D>("popUpBackground");
            greyBar         = Content.Load <Texture2D>("grayTexture");
            creditImage     = Content.Load <Texture2D>("EndCredits");
            heartPic        = Content.Load <Texture2D>("heartSheet");
            guardIcon       = Content.Load <Texture2D>("guard");
            prisonerIcon    = Content.Load <Texture2D>("prisoner");
            p2Icon          = Content.Load <Texture2D>("P2Icon");

            TextureLib ts = new TextureLib(GraphicsDevice);
            TextureLib.loadFromManifest();

            aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;

            bloomFilter = Content.Load <Effect>("BloomShader");

            BackGroundAudio music = new BackGroundAudio(Content);

            music.addSong("Menu");
            music.addSong("RPG Game");
            AudioLib lb = new AudioLib();

            tenbyFive8       = Content.Load <SpriteFont>("tenbyFive/tenbyFive8");
            tenbyFive10      = Content.Load <SpriteFont>("tenbyFive/tenbyFive10");
            tenbyFive14      = Content.Load <SpriteFont>("tenbyFive/tenbyFive14");
            tenbyFive24      = Content.Load <SpriteFont>("tenbyFive/tenbyFive24");
            tenbyFive72      = Content.Load <SpriteFont>("tenbyFive/tenbyFive72");
            font             = tenbyFive14;
            testComputerFont = tenbyFive24;

            levelExitVideo          = Content.Load <Video>("fmv/elevatorExit");
            levelEnterVideo         = Content.Load <Video>("fmv/levelStart");
            titleScreenVideo        = Content.Load <Video>("fmv/menu");
            introCutScene           = Content.Load <Video>("fmv/intro");
            introCutSceneCoop       = Content.Load <Video>("fmv/intro COOP");
            levelEnterVideoCoop     = Content.Load <Video>("fmv/levelStartCOOP");
            levelExitVideoCoop      = Content.Load <Video>("fmv/elevatorExitCOOP");
            guardEndCutScene        = Content.Load <Video>("fmv/endGuardSingle");
            alienEndCutScene        = Content.Load <Video>("fmv/endAlienSingle");
            prisonerEndCutScene     = Content.Load <Video>("fmv/endPrisonerSingle");
            guardEndCutSceneCoop    = Content.Load <Video>("fmv/endGuardCoop");
            alienEndCutSceneCoop    = Content.Load <Video>("fmv/endAlienCoop");
            prisonerEndCutSceneCoop = Content.Load <Video>("fmv/endPrisonerCoop");
            videoPlayer             = new VideoPlayer();

            ChunkLib cs = new ChunkLib();

            AnimationLib.loadFrameFromManifest();

            GlobalGameConstants.WeaponDictionary.InitalizePriceData();

            GameCampaign.InitalizeCampaignData();
            GameCampaign.ResetPlayerValues("INIT", 0);

            // lol so many game screens
            currentGameScreen = new TitleScreen(TitleScreen.titleScreens.logoScreen);
            //currentGameScreen = new CutsceneVideoState(testVideo, ScreenState.ScreenStateType.LevelReviewState);
            //currentGameScreen = new CampaignLobbyState();
            //currentGameScreen = new HighScoresState(true);

            // DANIEL UNCOMMMENT THIS LINE BEFORE YOU MERGE WITH MASTER
            preloadedAssets = true;
        }
        private void renderGUI(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, float scale)
        {
            Texture2D tex  = TextureLib.getLoadedTexture("wireFramePieces.png");
            Texture2D tex2 = TextureLib.getLoadedTexture("roguefakewireframe.png");

            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
            sb.Draw(Game1.whitePixel, new Vector2(-99999, -99999) / 2, null, Color.Black, 0.0f, Vector2.Zero, new Vector2(99999, 99999), SpriteEffects.None, 0.0f);
            Vector2 linesOffset = new Vector2(CampaignLobbyState.lineOffset);

            for (int i = -6; i < GlobalGameConstants.GameResolutionWidth / 16 + 8; i++)
            {
                drawLine(sb, new Vector2(i * 16, -16) + linesOffset, GlobalGameConstants.GameResolutionHeight + 32, (float)Math.PI / 2, new Color(1, 0, 1, 0.1f), 1.0f);
            }
            for (int i = -6; i < GlobalGameConstants.GameResolutionHeight / 16 + 8; i++)
            {
                drawLine(sb, new Vector2(-16, i * 16) + linesOffset, GlobalGameConstants.GameResolutionWidth + 32, 0, new Color(1, 0, 1, 0.1f), 1.0f);
            }
            sb.End();

            sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null, null, Matrix.CreateTranslation(-575, -100, 0) * Matrix.CreateScale(1.0f, cursorAnimationTime > 500f ? 1.0f : (cursorAnimationTime / 500f), 1.0f) * Matrix.CreateScale(scale));

            sb.Draw(wireframe, new Vector2(-150, 0), null, Color.Lerp(Color.DarkCyan, Color.Black, 0.375f + (0.025f * (float)Math.Sin(cursorAnimationTime / 10))), 0.0f, Vector2.Zero, new Vector2(1), SpriteEffects.FlipHorizontally, 0.0f);
            sb.Draw(tex2, new Vector2(575, 100) + new Vector2(130, 220), null, Color.White, 0.0f, Vector2.Zero, new Vector2(0.046f, 0.0666f), SpriteEffects.None, 0.0f);

            for (int i = 0; i < GameCampaign.levelMap.GetLength(0); i++)
            {
                for (int j = 0; j < GameCampaign.levelMap.GetLength(1); j++)
                {
                    if (!GameCampaign.levelMap[i, j].visible)
                    {
                        continue;
                    }

                    if (i == 0 && j == 1)
                    {
                        sb.DrawString(Game1.tenbyFive10, "HANGAR", new Vector2(i * 128, j * 96) + drawMapTestOffset - new Vector2(0, 18), Color.Cyan);
                    }
                    else if (i == 5 && j == 1)
                    {
                        sb.DrawString(Game1.tenbyFive10, "BRIDGE", new Vector2(i * 128, j * 96) + drawMapTestOffset - new Vector2(0, 18), Color.Cyan);
                    }
                    else
                    {
                        sb.DrawString(Game1.tenbyFive10, "ZONE " + i + (j == 0 ? 'A' : ((j == 1) ? 'B' : 'C')), new Vector2(i * 128, j * 96) + drawMapTestOffset - new Vector2(0, 18), Color.Cyan);
                    }

                    if (i == GameCampaign.PlayerLevelProgress && j == GameCampaign.PlayerFloorHeight)
                    {
                        sb.Draw(tex, new Vector2(i * 128, j * 96) + drawMapTestOffset, new Rectangle(48, 0, 48, 48), Color.Blue);
                    }
                    else if (i == selectedLevelX && j == selectedLevelY)
                    {
                        sb.Draw(tex, new Vector2(i * 128, j * 96) + drawMapTestOffset, new Rectangle(0, 48, 48, 48), Color.Green);
                    }
                    else
                    {
                        sb.Draw(tex, new Vector2(i * 128, j * 96) + drawMapTestOffset, new Rectangle(0, 48, 48, 48), Color.Cyan);
                    }
                }
            }

            if (state == LevelSelectStateState.Idle)
            {
                drawLine(sb, drawMapTestOffset + new Vector2(24) + new Vector2(GameCampaign.PlayerLevelProgress * 128, GameCampaign.PlayerFloorHeight * 96), GameCampaign.PlayerFloorHeight == selectedLevelY ? 128f : 155f, 0.85f * (float)((-Math.PI / 2) + Math.Atan2(selectedLevelX - GameCampaign.PlayerLevelProgress, GameCampaign.PlayerFloorHeight - selectedLevelY)), Color.Gray, 3.5f);
            }

            sb.Draw(tex, cursorPosition + new Vector2(24), new Rectangle(0, 0, 48, 48), Color.Red, 0.0f, new Vector2(24), 1 + (0.2f * (float)Math.Sin(cursorAnimationTime / 250f)), SpriteEffects.None, 0.5f);

            Rectangle rx = XboxTools.GetTitleSafeArea(AnimationLib.GraphicsDevice, 0.8f);

            rx.X += 575;
            rx.Y += 100;

            sb.Draw(Game1.whitePixel, rx, new Color(0.0f, 0.75f, 1.0f, 0.1f));

            if (GameCampaign.PlayerLevelProgress >= GlobalGameConstants.LevelAliensAppearAt - 1)
            {
                drawBox(sb, new Rectangle(755, 500, 305, 200), Color.Cyan, 2);
                sb.DrawString(Game1.testComputerFont, "\n\nPrisoner Rates: " + Math.Round(100 * (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates))) + "%", testDetailStuff, Color.Orange);
                sb.DrawString(Game1.testComputerFont, "\n\n\n\nAlien Rates: " + Math.Round(100 * (GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates))) + "%", testDetailStuff, Color.Red);
                sb.DrawString(Game1.testComputerFont, "\n\n\nGuard Rates: " + Math.Round(100 * (GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates))) + "%", testDetailStuff, Color.LightBlue);
            }
            else
            {
                drawBox(sb, new Rectangle(755, 500, 305, 200), Color.Cyan, 2);
                sb.DrawString(Game1.testComputerFont, "\n\nPrisoner Rates: " + Math.Round(100 * (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates))) + "%", testDetailStuff + (Game1.testComputerFont.MeasureString("Alien Rates") * new Vector2(0, 0.5f)), Color.Orange);
                sb.DrawString(Game1.testComputerFont, "\n\n\nGuard Rates: " + Math.Round(100 * (GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates))) + "%", testDetailStuff + (Game1.testComputerFont.MeasureString("Alien Rates") * new Vector2(0, 0.5f)), Color.LightBlue);
            }

            sb.Draw(Game1.whitePixel, new Vector2(75, 0) + testDetailStuff - new Vector2(1, 1), null, Color.Black, 0.0f, Vector2.Zero, new Vector2(127, 34), SpriteEffects.None, 0.5f);
            sb.Draw(Game1.whitePixel, new Vector2(75, 0) + testDetailStuff, null, Color.Orange, 0.0f, Vector2.Zero, new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 32), SpriteEffects.None, 0.5f);
            sb.Draw(Game1.whitePixel, new Vector2(75, 0) + testDetailStuff + new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 0), null, Color.Red, 0.0f, Vector2.Zero, new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 32), SpriteEffects.None, 0.5f);
            sb.Draw(Game1.whitePixel, new Vector2(75, 0) + testDetailStuff + new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 0) + new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 0), null, Color.LightBlue, 0.0f, Vector2.Zero, new Vector2((float)(GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates / (GameCampaign.levelMap[selectedLevelX, selectedLevelY].prisonerRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].guardRates + GameCampaign.levelMap[selectedLevelX, selectedLevelY].alienRates)) * 125, 32), SpriteEffects.None, 0.5f);

            Rectangle contractBox = new Rectangle(1125, 525, 550, 200);

            drawBox(sb, contractBox, Color.Cyan, 2);
            sb.DrawString(Game1.tenbyFive24, "Contract", new Vector2(1325, 525), Color.Cyan);
            sb.DrawString(Game1.tenbyFive14, GameCampaign.levelMap[selectedLevelX, selectedLevelY].contract.contractMessage, new Vector2(1140, 565), Color.Cyan);

            sb.End();
        }
        private void loadLevel()
        {
            for (int i = 0; i < GameCampaign.CampaignIntroductionValues[GameCampaign.PlayerLevelProgress].Length; i++)
            {
                GameCampaign.AvailableEntityTypes.Add(GameCampaign.CampaignIntroductionValues[GameCampaign.PlayerLevelProgress][i]);
            }

            nodeMap = generateFourDungeons();
            //nodeMap = DungeonGenerator.generateEntityZoo();
            map = new TileMap(this, nodeMap, GlobalGameConstants.TileSize);

            string tileSetName = "deathStar";

            if (GameCampaign.PlayerFloorHeight == 0)
            {
                tileSetName = "hightech";
            }
            if (GameCampaign.PlayerFloorHeight == 1)
            {
                tileSetName = "factory";
            }
            if (GameCampaign.PlayerFloorHeight == 2)
            {
                tileSetName = "prisoncell";
            }

            map.TileSkin[0] = TextureLib.getLoadedTexture(tileSetName + "/0.png");
            map.TileSkin[1] = TextureLib.getLoadedTexture(tileSetName + "/1.png");
            map.TileSkin[2] = TextureLib.getLoadedTexture(tileSetName + "/2.png");
            map.TileSkin[3] = TextureLib.getLoadedTexture(tileSetName + "/3.png");

            map.ElevatorRoomSkin = TextureLib.getLoadedTexture("elevator/0.png");

            Thread.Sleep(250);

            endFlagReached = false;

            gui       = new InGameGUI(this);
            keyModule = new LevelKeyModule();

            particleSet = new ParticleSet();

            Thread.Sleep(250);

            entityList   = new List <Entity>();
            acidSpitters = new List <MutantAcidSpitter>();

            coinPool      = new Coin[coinPoolSize];
            freeCoinIndex = 0;
            for (int i = 0; i < coinPoolSize; i++)
            {
                coinPool[i] = new Coin(this, new Vector2(-100, -100));
                entityList.Add(coinPool[i]);
            }

            Thread.Sleep(250);

            populateRooms(nodeMap, currentSeed);

            Thread.Sleep(250);

            for (int i = 0; i < entityList.Count; i++)
            {
                if (entityList[i] is Player && ((Player)entityList[i]).Index == InputDevice2.PPG_Player.Player_1)
                {
                    cameraFocus = entityList[i];
                }
            }

            fadeOutTime = 0.0f;

            elapsedLevelTime  = 0.0f;
            elapsedCoinAmount = 0;

            player1Dead     = false;
            end_flag_placed = false;

            BackGroundAudio.playSong("RPG Game", true);
            BackGroundAudio.changeVolume(1.0f);

            state = LoadingState.LevelRunning;
        }