示例#1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            m_font      = Game.Content.Load <SpriteFont>(@"Comic");
            m_fontLarge = Game.Content.Load <SpriteFont>(@"ComicLarge");

            player.Initialize();
            Game.Services.AddService(typeof(Interfaces.IPlayer), player);

            camera.Initialize();
            camera.Position = new Vector3(0 * cameraZoom, 1688.753f * cameraZoom, -2228.385f * cameraZoom);
            camera.LookAt   = new Vector3(0, 0, 20);
            Game.Services.AddService(typeof(Interfaces.ICamera), camera);

            scenery.Initialize();
            castleHandler.Initialize();
            Game.Services.AddService(typeof(Interfaces.ICastle), castleHandler.Castle);
            spellHandler.Initialize();
            Game.Services.AddService(typeof(Interfaces.ISpellHandler), spellHandler);
            enemyHandler.Initialize();

            enemyHandler.SpawnEnemyTypes.Add(EnemyHandler.Enemies.Slime);

            fireBallParticles.Initialize();
            slowEnemyParticles.Initialize();
            poisonEnemyParticles.Initialize();
            magicMissilePartilces.Initialize();
            dirtPartilces.Initialize();

            base.Initialize();
        }