/// <summary>
        /// Constructs RenderManager using a SpriteBatch object which will be used for drawing.
        /// </summary>
        /// <param name="spriteBatch">MonoGames SpriteBatch object.</param>
        /// <param name="graphics">MonoGames GraphicsDevice object.</param>
        /// <param name="mainGame">Game1 class to interact with other managers.</param>
        public RenderManager(SpriteBatch spriteBatch, GraphicsDevice graphics, WorldManager worldManager)
        {
            this.spriteBatch = spriteBatch;
            this.graphics = graphics;
            this.worldManager = worldManager;
            this.mainGame = Game1.Instance;

            particles = new List<Particle>();
            dialogs = new List<Dialog>();

            viewportHeight = graphics.Viewport.Height;
            viewportWidth = graphics.Viewport.Width;

            viewportDeltaWidth = 0;
            viewportDeltaHeight = 0;

            mainGame.Window.ClientSizeChanged += Window_ClientSizeChanged;

            //lastWep = -1;

            // WHAT IF PLAYER CHANGES WORLD (?)
            player = mainGame.worldManager.CurrentWorld.manager.GetPlayer();

            // Load all textures once (constructor will only be called once, so will this method)
            LoadTextures();
        }
Beispiel #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            state = GameState.Menu;
            random = new Random();
            saveManager = new SaveManager();
            worldManager = new WorldManager();
            inputManager = new InputManager();
            collisionManager = new CollisionManager();

            base.Initialize();
        }