예제 #1
0
 public Camera2D(Game game, Hero.Hero hero)
     : base(game)
 {
     _position       = new Vector2(0, 0);
     _viewportHeight = game.Window.ClientBounds.Height / 2;
     _viewportWidth  = game.Window.ClientBounds.Width / 2;
     mhero           = hero;
     instance        = this;
 }
예제 #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
            IsMouseVisible = true;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            SoundManager.Getinstance().Initialize();

            hero = new Hero.Hero(new Vector2(WindowsManager.GetInstance().ScreenWidth / 2, WindowsManager.GetInstance().ScreenHeight / 2), 120, 140, new Vector2(5, 5), 0.0f, new Vector2(0, 0), new Vector2(1, 1), Color.White, true);
            hero.InitWeapon();


            camera = new Camera2D(this, hero);
            Components.Add(camera);

            uiComponent = new Component.HeroUIDrawComponent(this, spriteBatch);
            Components.Add(uiComponent);
            bossuiComponent = new Component.BossUIComponent(this, spriteBatch);
            Components.Add(bossuiComponent);
            //debugmanager = new DebugManager(this, spriteBatch);
            //Components.Add(debugmanager);
            base.Initialize();
        }