Exemple #1
0
        /// <summary>
        /// Starts up a game engine for the specified map
        /// </summary>
        /// <param name="mapName">The name given to the map in the file system</param>
        public Engine(String mapName)
        {
            if (instance != null)
            {
                #region Cleanup the old instance
                instance = null;
                map = null;
                bullets = null;
                explosions = null;
                lua = null;
                sound = null;
                player = null;
				boss = null;
                System.GC.Collect();
                #endregion
            }
            instance = this;
            sound = SnailsPace.soundManager;
            
            // Stuff needed by maps
            loadFonts();
            
            // Initialize Lua, the Player, and the Map
            lua = new GameLua(mapName);
            map = new Map(mapName);

            // Setup lists for objects that will be used later
            bullets = new List<Bullet>();
            explosions = new List<Explosion>();
            collidingObjects = new List<GameObject>();

            // Load the Fonts, Sprites, and some helper Game Objects that will be needed.
            loadHUD();
            setupPauseOverlay();
            setupMapBounds();

            // Initialize the Renderer
            setupGameRenderer();
        }
Exemple #2
0
 /// <summary>
 /// Start up the engine using the current map
 /// </summary>
 protected void loadEngine()
 {
     engine = new Engine(map);
     Core.Player.time = 0;
     switch (map)
     {
         case "Tree Fort":
             Core.Player.timeLimit = 100;
             break;
         case "Garden":
             Core.Player.timeLimit = 360;
             break;
         case "Garden2":
             Core.Player.timeLimit = 300;
             break;
         case "Credits":
             Core.Player.timeLimit = 0;
             break;
         default:
             Core.Player.timeLimit = 500;
             break;
     }
     ready = true;
 }