Example #1
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)
        {
//			if (Keyboard.GetState().IsKeyDown(Keys.Z))
//				this.TargetElapsedTime = TimeSpan.FromSeconds(0.3f);
//			else
//				this.TargetElapsedTime = TimeSpan.FromSeconds(0.016f);

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                if (!escapePressed)
                {
                    escapePressed = true;
                    currentScreen = currentScreen == null ? null : currentScreen.Exit();
                }
            }
            else
            {
                escapePressed = false;
            }

            currentScreen = currentScreen == null ? null : currentScreen.Update(gameTime);
            if (currentScreen == null)
            {
                this.Exit();
            }

            base.Update(gameTime);
        }
        public void ShowGameOver(Screens.GameScreen currentScreen)
        {
            this.GameOverInstance.Visible = true;

            //this.GameOverInstance.CurrentVisualsAlphaState = GameOverRuntime.VisualsAlpha.Transparent;
            this.GameOverInstance.PopupAppearAnimation.Play();
            this.GameOverInstance.PopupAppearAnimation.EndReached += () =>
            {
                GameOverInstance.FadeToBlackAnimation.PlayAfter(3);
                GameOverInstance.FadeToBlackAnimation.EndReached += () =>
                {
                    currentScreen.RestartScreen(false);
                };
            };
        }
Example #3
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);

            fnt_basicFont = Content.Load <SpriteFont>("fonts/basicFont");

            tex_box    = Content.Load <Texture2D>("textures/box");
            tex_bullet = Content.Load <Texture2D>("textures/weapons/boolit");
            tex_gun    = Content.Load <Texture2D>("textures/weapons/temp gun");
            tex_head   = Content.Load <Texture2D>("textures/stick figure/head");
            tex_limb   = Content.Load <Texture2D>("textures/stick figure/limb");
            tex_torso  = Content.Load <Texture2D>("textures/stick figure/torso");

            currentScreen = new Screens.MainMenu();
        }
Example #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);

            fnt_basicFont = Content.Load<SpriteFont>("fonts/basicFont");

            tex_box = Content.Load<Texture2D>("textures/box");
            tex_bullet = Content.Load<Texture2D>("textures/weapons/boolit");
            tex_gun = Content.Load<Texture2D>("textures/weapons/temp gun");
            tex_head = Content.Load<Texture2D>("textures/stick figure/head");
            tex_limb = Content.Load<Texture2D>("textures/stick figure/limb");
            tex_torso = Content.Load<Texture2D>("textures/stick figure/torso");

            currentScreen = new Screens.MainMenu();
        }
Example #5
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)
        {
            //			if (Keyboard.GetState().IsKeyDown(Keys.Z))
            //				this.TargetElapsedTime = TimeSpan.FromSeconds(0.3f);
            //			else
            //				this.TargetElapsedTime = TimeSpan.FromSeconds(0.016f);

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                if (!escapePressed)
                {
                    escapePressed = true;
                    currentScreen = currentScreen == null ? null : currentScreen.Exit();
                }
            }
            else
                escapePressed = false;

            currentScreen = currentScreen == null ? null : currentScreen.Update(gameTime);
            if (currentScreen == null)
                this.Exit();

            base.Update(gameTime);
        }
 public TutorialScript(Screens.GameScreen screen)
 {
     _gameScreen   = screen;
     ExecutionMode = ExecutionModes.Linear;
 }