コード例 #1
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
            map = new Map(this);
            Components.Add(map);
            spriteManager = new SpriteManager(this);
            Components.Add(spriteManager);

            menu = new Menu(this);
            Components.Add(menu);
            mainMenu = new MainMenu(this);
            Components.Add(mainMenu);
            statsScreen = new StatsScreen(this);
            Components.Add(statsScreen);
            iface = new Interface(this);
            Components.Add(iface);

            gameState = GameStates.Main_Menu;


            base.Initialize();
        }
コード例 #2
0
        /// <summary>
        /// Reset the game
        /// </summary>
        public void resetGame()
        {
            //delete old
            Components.Remove(map);
            Components.Remove(spriteManager);
            Components.Remove(menu);
            Components.Remove(mainMenu);
            Components.Remove(statsScreen);
            Components.Remove(iface);

            map           = new Map(this);
            spriteManager = new SpriteManager(this);
            Components.Add(map);
            Components.Add(spriteManager);

            menu = new Menu(this);
            Components.Add(menu);
            mainMenu = new MainMenu(this);
            Components.Add(mainMenu);
            statsScreen = new StatsScreen(this);
            Components.Add(statsScreen);
            iface = new Interface(this);
            Components.Add(iface);
        }