Example #1
0
        /// <summary>
        /// Loads the specified map from the passed filename
        /// </summary>
        /// <param name="filename">Map file to load</param>
        /// <param name="content">Content manager for loading graphics</param>
        /// <param name="graphics">Graphics for rendering to the screen</param>
        /// <param name="playerArg">Player party to be rendered on the screen</param>
        /// <returns>True if the load succeeded, false otherwise</returns>
        public static bool LoadMapEngine(string filename,
            GraphicsDevice graphics, ContentManager content, CharacterBase playerArg,
            WorldDirector director)
        {
            // Clears any previously loaded map
            ClearMapEngine();

            // Create a new instance of the MapEngine
            singleton = new MapEngine(graphics, content);

            // Set the player
            Player = playerArg;

            // FIX:  Store the world director
            singleton.director = director;

            // Load the map file
            // DEBUG:  Loading default map
            singleton.mapInfo = content.Load<MapData>(@"Maps/MapTest");

            // DEBUG: Load tests
            singleton.LoadTests();

            // Set Up a 2D Camera
            singleton.camera = new Camera2D();

            ResetToInitialPositions();
            singleton.RepositionPlayer();

            return true;
        }
Example #2
0
        /// <summary>
        /// Clears any previously loaded map
        /// </summary>
        /// <returns>True if suceeded, false otherwise</returns>
        public static bool ClearMapEngine()
        {
            if (singleton != null)
            {
                singleton = null;
            }

            return true;
        }