コード例 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            if (Title)
            {
                // Display Title Screen
                spriteBatch.Draw(titleScreen, new Rectangle(0, 0, 800, 600), Color.White);
            }
            else if (Failure)
            {
                // Display Failure screen
            }
            else if (Success)
            {
                // Display Success Screen
            }
            else
            {
                TileMap.Draw(spriteBatch);
                Player.Draw(spriteBatch);
                EncounterManager.Draw(spriteBatch);
            }
            FadeMessageManager.Draw(spriteBatch);

            spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #2
0
        public override void EncounterResult(bool action1Selected)
        {
            if (action1Selected)
            {
                int roll = Random.Next(1, 5);

                string message = "They find no way to help, and wish you good luck.";
                switch (roll)
                {
                case 1:
                    roll              = Random.Next(1, 10);
                    message           = string.Format("Excellent, scanner range improved by {0}%!", roll);
                    Player.LongRange += (int)(Player.LongRange * roll / 100);
                    break;

                case 2:
                    roll              = Random.Next(9, 26);
                    message           = string.Format("Excellent, scanner range improved by {0}%!", roll);
                    Player.LongRange += (int)(Player.LongRange * roll / 100);
                    break;

                case 3:
                    roll = Random.Next(1, 10);
                    if (roll == 7)
                    {
                        message           = "Through and unfortunate accident, the scanner array is damaged, range reduced to 80%!!";
                        Player.LongRange -= (int)(Player.LongRange * 0.80);
                    }
                    break;

                case 4:
                    roll = Random.Next(1, 10);
                    if (roll == 10)
                    {
                        message       = "The entire crew has been exposed to an alien deseases and the quarantine failed.\r\nThe entire crew eventually dies.\r\nYou’ve failed and human's are extinct.";
                        Game1.Failure = true;
                    }
                    break;

                case 5:
                    roll                = Random.Next(1, 9);
                    message             = string.Format("Engine's improved, speed increased by {0}%!", roll);
                    Player.PlayerSpeed += (int)(Player.PlayerSpeed * roll / 100);
                    break;
                }
                FadeMessageManager.Show(message);
            }

            EncounterManager.EncounterActive = false;

            LongRangeScanned = true;

            TextureNames textureName = (TextureNames)Random.Next((int)TextureNames.Empty1, (int)TextureNames.Empty4);
            TextureLink  textureLink = TextureManager.Textures[textureName];

            BaseSprite.TintColor = Color.Gray;

            Encounter = false;
        }
コード例 #3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            KeyboardState keyboard = Keyboard.GetState();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                keyboard.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            if (FrameClear.IsClear < gameTime.TotalGameTime.TotalSeconds)
            {
                if (Title)
                {
                    // Display Title Screen
                    FadeMessageManager.Update(gameTime);
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        Title = false;
                        RestartGame();
                    }
                }
                else if (Failure)
                {
                    // Display Failure screen
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        Title              = true;
                        Failure            = false;
                        FrameClear.IsClear = gameTime.TotalGameTime.TotalSeconds + 0.3;
                    }
                }
                else if (Success)
                {
                    // Display Success Screen
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        Title              = true;
                        Success            = false;
                        FrameClear.IsClear = gameTime.TotalGameTime.TotalSeconds + 0.3;
                    }
                }
                else
                {
                    Player.Update(gameTime);

                    EncounterManager.Update(gameTime);
                    FadeMessageManager.Update(gameTime);
                }
            }

            base.Update(gameTime);
        }
コード例 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            spriteSheet = Content.Load <Texture2D>(@"Textures\SpriteSheet");
            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            pericles    = Content.Load <SpriteFont>(@"Fonts\Pericles");

            SoundManager.Initialize(Content);
            TextureManager.Initialize(Content, spriteSheet);
            EncounterManager.Initialize(pericles);
            FadeMessageManager.Initialize(pericles);
        }
コード例 #5
0
        public override void EncounterResult(bool action1Selected)
        {
            if (action1Selected)
            {
                int roll = Random.Next(1, 30);

                string message = "The scout ship hits a space mine and is discovered!\r\nThe planet hits the ship with several nuclear weapons!\r\nRadiation kills most of the crew.\r\nYou have failed.\r\nHumanity devolves to is caveman roots.";
                Game1.Failure = true;
                FadeMessageManager.Show(message);
            }

            EncounterManager.EncounterActive = false;

            BaseSprite.TintColor = Color.Gray;

            Encounter = false;
        }
コード例 #6
0
        public override void EncounterResult(bool action1Selected)
        {
            if (action1Selected)
            {
                int roll = Random.Next(1, 30);

                string message = "You find nothing but a hauntingly empty planet.";
                switch (roll)
                {
                case 1:
                    message           = "You accidently bring a computer virus back to the ship.\r\nIt damages the sensors before being nuetralized, scanner range decreased 40%!";
                    Player.LongRange -= (int)(Player.LongRange * 0.40);
                    break;

                case 2:
                    message           = "An automated defensive system hacker the computer and uploads a virus.\r\nDamage to the sensors reduces range by 25%!";
                    Player.LongRange -= (int)(Player.LongRange * 0.25);
                    break;

                case 3:
                    message = "Several crew men are exposed to ERL,\r\nluckily quarantine procedures worked and the mission is not harmed.";
                    break;

                case 4:
                    message       = "Due to a quarantine failure the entire crew has been exposed to a new strain of ERL.\r\nThe entire crew eventually dies.\r\nYou’ve failed and humanity has been completely whipped out.";
                    Game1.Failure = true;
                    break;

                case 5:
                    message       = "You discover that the planet was suffering from ERL too.\r\nAstoundingly, they managed to study the disease for two CENTRIES before succumbing!\r\nTheir treatments will slow the progress of the disease tremendously and save billions of lives.\r\nCongratulations, the mission is a success.  You are a hero.\r\nHumanity learns to manage the disease and eventually after fourteen centuries develops a cure.\r\n\r\nIts origins still remain a mystery.";
                    Game1.Success = true;
                    break;
                }
                FadeMessageManager.Show(message);
            }

            EncounterManager.EncounterActive = false;

            BaseSprite.TintColor = Color.Gray;

            Encounter = false;
        }
コード例 #7
0
        private void RestartGame()
        {
            int startX = Random.Next(Convert.ToInt32(TileMap.MapWidth * 0.4), Convert.ToInt32(TileMap.MapWidth * .6));
            int startY = Random.Next(Convert.ToInt32(TileMap.MapHeight * 0.4), Convert.ToInt32(TileMap.MapHeight * .6));

            Player.Initialize(
                spriteSheet,
                new Rectangle(0, 64, 32, 32),
                6,
                new Vector2(startX * TileMap.TileWidth, startY * TileMap.TileHeight)
                );


            Camera.WorldRectangle = new Rectangle(0, 0, TileMap.MapWidth * TileMap.TileWidth, TileMap.MapHeight * TileMap.TileHeight);
            Camera.ViewPortWidth  = 800;
            Camera.ViewPortHeight = 600;
            Camera.Position       = new Vector2(startX * TileMap.TileWidth - Camera.ViewPortWidth / 2, startY * TileMap.TileHeight - Camera.ViewPortHeight / 2);

            TileMap.Initialize(spriteSheet);

            EncounterManager.EncounterActive = false;
            FadeMessageManager.Show("Good Luck Captain!  All of humanity is with you.");
        }