Пример #1
0
 private void LoadScreens()
 {
     SplashScreen       = new SplashScreen(this);
     SetupScreen        = new SetupScreen(this);
     InstructionsScreen = new InstructionsScreen(this);
     GameOverScreen     = new GameOverScreen(this);
 }
Пример #2
0
        private void UpdateStarting(GameTime gameTime)
        {
            GamePadState  newGamePadState  = GamePad.GetState(PlayerIndex.One);
            KeyboardState newKeyboardState = Keyboard.GetState();

            if ((newGamePadState.Buttons.Back != oldGamePadState.Buttons.Back && newGamePadState.Buttons.Back == ButtonState.Pressed) ||
                (Keyboard.GetState().IsKeyDown(Keys.Escape) && oldKeyboardState.IsKeyUp(Keys.Escape)))
            {
                this.gameWillQuit = true;
            }

            switch (gameStartingScreen)
            {
            case GameStartingScreen.SplashScreen: SplashScreen.Update(gameTime, newGamePadState, oldGamePadState, newKeyboardState, oldKeyboardState); break;

            case GameStartingScreen.SetupScreen: SetupScreen.Update(gameTime, newGamePadState, oldGamePadState, newKeyboardState, oldKeyboardState); break;

            case GameStartingScreen.InstructionsScreen: InstructionsScreen.Update(gameTime, newGamePadState, oldGamePadState, newKeyboardState, oldKeyboardState); break;

            case GameStartingScreen.GameOverScreen: GameOverScreen.Update(gameTime, newGamePadState, oldGamePadState, newKeyboardState, oldKeyboardState); break;
            }

            oldGamePadState  = newGamePadState;
            oldKeyboardState = newKeyboardState;
        }
Пример #3
0
        protected override void LoadContent()
        {
            Fonts.LoadFonts(Content, "Fonts.xml");
            Sounds.LoadSounds(Content, "Sounds.xml");

            // Load Game Content
            startingSpriteBatch = new SpriteBatch(this.graphics.GraphicsDevice);

            // Get Screen Size
            int screenWidth  = this.Window.ClientBounds.Width;
            int screenHeight = this.Window.ClientBounds.Height;

            // Load Control Content
            TextPickerControl.LoadContent(Content);

            // Load Screen Content
            SplashScreen.LoadContent(Content);
            SetupScreen.LoadContent(Content);
            InstructionsScreen.LoadContent(Content);
            GameOverScreen.LoadContent(Content);
            LoadScreens();

            // Load Subsystem Contents
            SurvivorSubsystem.LoadContent(Content);
            ZombiesSubsystem.LoadContent(Content);
            CollectablesSubsystem.LoadContent(Content);
            AchievmentsSubsystem.LoadContent(Content);

            // Load Entity Contents
            HUD.LoadContent(Content, screenWidth, screenHeight);

            String saveFilePath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "save.sav");

            if (File.Exists(saveFilePath))
            {
                FileStream     fileStream     = File.OpenRead(saveFilePath);
                XmlSerializer  fileSerializer = new XmlSerializer(typeof(GameSaveStruct));
                GameSaveStruct gameSaveStruct = (GameSaveStruct)fileSerializer.Deserialize(fileStream);
                fileStream.Close();
                File.Delete(saveFilePath);
                GameState = GameState.Playing;
                this.StartPlayingSavedGame(gameSaveStruct);
            }
            else
            {
                ResetToStarting(true);
            }

            base.LoadContent();
        }
Пример #4
0
        private void DrawStarting(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(94, 99, 92));
            startingSpriteBatch.Begin();

            switch (gameStartingScreen)
            {
            case GameStartingScreen.SplashScreen: SplashScreen.Draw(gameTime, startingSpriteBatch);; break;

            case GameStartingScreen.SetupScreen: SetupScreen.Draw(gameTime, startingSpriteBatch); break;

            case GameStartingScreen.InstructionsScreen: InstructionsScreen.Draw(gameTime, startingSpriteBatch); break;

            case GameStartingScreen.GameOverScreen: GameOverScreen.Draw(gameTime, startingSpriteBatch); break;
            }

            startingSpriteBatch.End();
        }
 private void LoadScreens()
 {
     SplashScreen = new SplashScreen(this);
     SetupScreen = new SetupScreen(this);
     InstructionsScreen = new InstructionsScreen(this);
     GameOverScreen = new GameOverScreen(this);
 }