Ejemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            //Final Updates
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            //gamestate switch
            switch (GameManager.gameState)
            {
            case GameState.MainMenu:
                Camera.UpdateMainMenu(gameTime);
                //MapHandler.Update(gameTime);
                MapHandler.UpdateMainMenu(gameTime);
                //GUI.UpdateMainMenu(cursor.boundingBox);
                GUI.UpdateMainMenu(cursor.spriteBox);
                break;

            case GameState.Pause:
                break;

            case GameState.GameplayLoop:     //normal gameplay
                MapHandler.Update(gameTime);
                PlayerManager.Update(gameTime);
                Camera.Update();
                GUI.Update();
                break;

            case GameState.Combat:     //in combat
                break;

            case GameState.NewGame:
                GUI.UpdateNewGameMenu(cursor.spriteBox);
                break;

            default:
                break;
            }

            cursor.Update(gameTime); //independent of gamestate

            //testing updates
            if (Keyboard.GetState().IsKeyDown(Keys.P))
            {
                SaveGame();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.O))
            {
                LoadGame();
            }
            //Console.WriteLine(ConsoleOutput); // uncomment after text implemented

            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        //old - update
        public void LoadGame()
        {
            Stream          streamread = File.OpenRead("default.bin");
            BinaryFormatter binaryread = new BinaryFormatter();
            SaveGame        Save       = (SaveGame)binaryread.Deserialize(streamread);

            streamread.Close();

            PlayerManager.SetPlayerParty(Save.SavedPlayerData);
            MapHandler.LoadMap(Save.SavedCurrentLevelName); //WILL NOT WORK PROPERLY WITHOUT ADDITION OF CODE TO SAVE/LOAD AVAILABLE MAPS
        }
Ejemplo n.º 3
0
        protected override void Initialize()
        {
            //Final Initialisations
            GameManager.Initialise();
            Fonts.Initialise(Content);
            Camera.Initialise(GraphicsDevice);
            PlayerManager.Initialize(Content, GraphicsDevice);
            GUI.Initialize(Content, GraphicsDevice);
            MapHandler.Initialize(Content, GraphicsDevice);
            cursor = new Cursor(Content);

            //Player = Content.Load<Texture2D>("player");

            //PlayerManager.NewPlayer("Test Character 2", new stats(), Vector2.Zero, Player);
            //PlayerManager.NewPlayer("Test Character 3", new stats(), new Vector2(0,100), Player)

            ConsoleStreamWriter ConsWtr = new ConsoleStreamWriter(ConsoleOutput);

            //Console.SetOut(ConsWtr);


            base.Initialize();
        }
Ejemplo n.º 4
0
        protected override void Draw(GameTime gameTime)
        {
            //Final Draws
            GraphicsDevice.Clear(Color.GhostWhite);

            switch (GameManager.gameState)
            {
            case GameState.MainMenu:
                MapHandler.DrawMainMenu(spriteBatch);
                GUI.DrawMainMenu(spriteBatch);
                break;

            case GameState.Pause:
                break;

            case GameState.NewGame:
                GUI.DrawNewGameMenu(spriteBatch);
                break;

            case GameState.GameplayLoop:
                //Use Elevation to order draws
                MapHandler.DrawLayer(spriteBatch, "Tile Layer 1");     //ground layer
                MapHandler.DrawLayer(spriteBatch, "Tile Layer 2");     //decoration layer
                PlayerManager.DrawElevation(spriteBatch, 0);
                MapHandler.DrawLayer(spriteBatch, "Tile Layer 3");     //elevated layer
                PlayerManager.DrawElevation(spriteBatch, 1);
                GUI.Draw(spriteBatch);
                break;

            default:
                break;
            }

            cursor.Draw(spriteBatch);

            base.Draw(gameTime);
        }