コード例 #1
0
        List <int> activeSpellCDs;                                                   //Tracks cooldown time when specific spell cast

        public PlayGame(GameAssets gameAssets, ViewPort viewPort, Factory objectFactory, ColliderHandler colliderHandler)
        {
            //I am assuming PlayGame is only created to start new game
            //correct me if im wrong.
            waveNum = 1;

            gui              = new GUI(objectFactory, viewPort);
            gameAssets_      = gameAssets;
            viewPort_        = viewPort;
            objectFactory_   = objectFactory;
            colliderHandler_ = colliderHandler;
            CurrentGameState = (int)GAME_STATES.PLAY_GAME;

            gui.GUIPlayGame();                                                      //Initialise GUI

            activeSpellCDs = new List <int>();
            for (int i = 0; i < Enum.GetNames(typeof(SPELL_TYPE)).Length; i++)
            {
                activeSpellCDs.Add(0);
            }

            //remove arbitrary timer value
            waveCompleteTimer          = new System.Timers.Timer(3000);
            waveCompleteTimer.Elapsed += CreateANewWave;
        }
コード例 #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
            SCREEN_WIDTH    = graphics.GraphicsDevice.Viewport.Width;
            SCREEN_HEIGHT   = graphics.GraphicsDevice.Viewport.Height;
            gameAssets      = new GameAssets();
            objectFactory   = new Factory(gameAssets);
            spriteManager   = new SpriteManager();
            spriteBatch     = new SpriteBatch(GraphicsDevice);
            viewPort        = new ViewPort(spriteBatch, SCREEN_WIDTH, SCREEN_HEIGHT);
            colliderHandler = new ColliderHandler();
            gameState       = new Intro();

            currentGameState = -1;

            wave = 1;

            //playGame = new PlayGame(gameAssets, viewPort, objectFactory, colliderHandler);
            //gameState.CurrentGameState = (int)GAME_STATES.PLAY_GAME;

            base.Initialize();
        }