示例#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()
        {
            random = new Random();

            player = new Player();
            boss   = new Boss();

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            enemies    = new List <Enemy> ();
            explosions = new List <Explosion> ();
            lasers     = new List <Laser> ();

            enemySpawnTime     = TimeSpan.FromSeconds(1.0f);
            prevEnemySpawnTime = TimeSpan.Zero;
            laserSpawnTime     = TimeSpan.FromSeconds(0.5f);

            healthBarVal  = Constants.PLAYER_HEALTH;
            maxEnemyCount = Constants.ENEMY_COUNT;
            score         = 0;
            bossFight     = false;

            GameState  = GameStates.Start;
            menuCursor = MenuOptions.Start;
            base.Initialize();
        }
        /// <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()
        {
            random = new Random ();

            player = new Player();
            boss = new Boss ();

            bgLayer1 = new ParallaxingBackground ();
            bgLayer2 = new ParallaxingBackground ();

            enemies = new List<Enemy> ();
            explosions = new List<Explosion> ();
            lasers = new List<Laser> ();

            enemySpawnTime = TimeSpan.FromSeconds (1.0f);
            prevEnemySpawnTime = TimeSpan.Zero;
            laserSpawnTime = TimeSpan.FromSeconds (0.5f);

            healthBarVal = Constants.PLAYER_HEALTH;
            maxEnemyCount = Constants.ENEMY_COUNT;
            score = 0;
            bossFight = false;

            GameState = GameStates.Start;
            menuCursor = MenuOptions.Start;
            base.Initialize ();
        }