예제 #1
0
        public override void Draw(GameTime gameTime)
        {
            GameRef.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            if (Input_Handler.KeyReleased(Keys.Escape))
            {
                GameRef.Exit();
            }

            objManager.Draw(GameRef.spriteBatch);

            GameRef.spriteBatch.End();
            base.Draw(gameTime);
        }
예제 #2
0
 public override void Update(GameTime gameTime)
 {
     //whenever the title screen updates, it updates the ControlManager
     if (Enabled)
     {
         objManager.Update(gameTime);
         base.Update(gameTime);
         if (Input_Handler.KeyDown(Microsoft.Xna.Framework.Input.Keys.F11) && KeyDown == false)
         {
             KeyDown = true;
         }
         if (KeyDown == true && Input_Handler.KeyReleased(Microsoft.Xna.Framework.Input.Keys.F11))
         {
             KeyDown = false;
         }
         if (loadBar.CurrentLoad == 100)
         {
             StateManager.AddLoaded(GameRef.GamePlayScreen);
         }
     }
 }
예제 #3
0
        public override void Update(GameTime gameTime)
        {
            if (hasPopped)
            {
                Reset();
                hasPopped = false;
            }

            StoryTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (StatusBar.Health <= 0)
            {
                GameOver(this, null);
            }
            if (Input_Handler.KeyReleased(Keys.Escape))
            {
                GameRef.Exit();
            }

            if (ObjManager.MoneyGain > 0)
            {
                Gold                += ObjManager.TakeMoney();
                StatusBar.Gold      += Gold;
                GameRef.player.gold += Gold;
                Gold                 = 0;
            }
            if (ObjManager.DamageGiven > 0)
            {
                Damage            = ObjManager.TakeDamage();
                StatusBar.Health -= Damage;
                Damage            = 0;
            }
            if (counter != 5)
            {
                time += gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (Input_Handler.KeyPressed(Keys.F11))
            {
                if (DevelopmentMode == false)
                {
                    DevelopmentMode = true;
                }
                else
                {
                    DevelopmentMode = false;
                }
            }

            #region Development
            if (DevelopmentMode)
            {
                if (Input_Handler.KeyPressed(Keys.I))
                {
                    //Waypoints.Enqueue(new Vector2(Mouse.GetState().X, Mouse.GetState().Y));
                }
                if (Input_Handler.KeyPressed(Keys.P))
                {
                    if (plotTexture == false)
                    {
                        GameRef.MousePointer = texTeleport;
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = true;
                    }
                    else
                    {
                        GameRef.MousePointer = Game.Content.Load <Texture2D>(@"UI Content\Pointer");
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = false;
                    }
                }
                if (Mouse.GetState().LeftButton == ButtonState.Pressed && placeLock == false)
                {
                    //save plot position
                    if (level == 0)
                    {
                        writer = new StreamWriter(@"GameData\Plot.txt", true);
                    }
                    else if (level == 1)
                    {
                        writer = new StreamWriter(@"GameData\Plot1.txt", true);
                    }
                    else if (level == 2)
                    {
                        writer = new StreamWriter(@"GameData\Plot2.txt", true);
                    }
                    else if (level == 3)
                    {
                        writer = new StreamWriter(@"GameData\Plot3.txt", true);
                    }

                    writer.WriteLine(Mouse.GetState().X.ToString() + "_" + Mouse.GetState().Y.ToString());
                    writer.Close();

                    ObjManager.AddLst.Add(new Plot(Content.Load <Texture2D>(@"UI Content\teleport_128"), new Vector2(Mouse.GetState().X, Mouse.GetState().Y), 5, 1, 0f, 0, 0, 0));

                    placeLock = true;
                }
                if (placeLock == true && Mouse.GetState().LeftButton == ButtonState.Released)
                {
                    placeLock = false;
                }
                if (Input_Handler.KeyPressed(Keys.O))
                {
                    writer = new StreamWriter(@"GameData\Plot.txt", true);
                    writer.Dispose();
                    writer.Close();
                    for (int x = 0; x < ObjManager.Count - 1; x++)
                    {
                        if (ObjManager[x].Type == "Plot")
                        {
                            ObjManager.RemoveAt(x);
                        }
                    }
                }
                #endregion
            }

            ObjManager.Update(gameTime);


            base.Update(gameTime);
        }