/* * GameWorld.cs * Authors: Brian Chesbrough * * Copyright Matthew Belmonte 2007 */ using System; using System.Collections.Generic; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using System.Diagnostics; using Pina3D.Particles; using tAC_Engine; namespace Game.Astropolis.HackerHavoc { /// /// This is the Game World for HackerHavok /// The game board and tiles are created and updated here /// All entities in the game world are stored here to be rendered /// class GameWorld { private SpriteBatch mSpriteBatch; // Internal buffer private List mLevels; // The levels that will be polayed through. private Level curLevel = null; private Viewport mLevelSpace; //Where on the screen the game will be drawn. // private Viewport mUISpace; //Where on the screen the UI will be drawn. public List Levels { get { return mLevels; } } /// /// Constructor /// This will initilize the game world to be drawn within the specified viewport /// /// public GameWorld(Viewport pGameSpace) { mSpriteBatch = new SpriteBatch(GenericBaseApplication.GameManager.GraphicsDevice); //initalize screen parameters mLevelSpace = pGameSpace; //This will be changed when the UI stuff needs to be drawn. //Start the game with one level mLevels = new List(); Level defaultLevel = new Level("Default",pGameSpace); curLevel = defaultLevel; mLevels.Add(defaultLevel); } /// /// Updates GameBoard related stuff: /// Screen Space variables /// Screen scrolling /// what entities are visible /// highlighted tile /// public void Update() { curLevel.Update(); } /// /// Draws all registered visible entities /// public void Render() { mSpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None); if (curLevel != null) { curLevel.Draw(mSpriteBatch); } mSpriteBatch.End(); } } }