Exemplo n.º 1
0
 protected override void OnInit()
 {
     base.OnInit();
     MFScene.GetScene <MFMainGameScene>().OnEventEntitySpawned   += this.OnEntitySpawned;
     MFScene.GetScene <MFMainGameScene>().OnEventEntityDestroyed += this.OnEntityDestroyed;
     MFScene.GetScene <MFMainGameScene>().OnEventGameState       += this.OnGameState;
 }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Env.OnInit(Content, spriteBatch, graphics);
            MFScene.CreateScene <MFMainGameScene>();
            MFScene.GetScene <MFMainGameScene>().Init();
            MFLayer.OnInit();
            MFMainGameControl.getInst.Init();

            // TODO: use this.Content to load your game content here
        }
Exemplo n.º 3
0
        protected override void OnDraw()
        {
            base.OnDraw();
            SpriteFont font     = Env.content.Load <SpriteFont>("SpriteFont1");
            int        playerHP = MFScene.GetScene <MFMainGameScene>().playerHP;

            if (font != null)
            {
                Env.spriteBatch.Begin();
                Env.spriteBatch.DrawString(font, playerHP.ToString(), new Vector2(10, 10), Color.White);
                Env.spriteBatch.End();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }
            Env.OnPreUpdate(gameTime);

            MFScene.GetScene <MFMainGameScene>().Update();
            MFMainGameControl.getInst.Update();
            MFLayer.OnLayerUpdate();

            Env.OnPostUpdate();
            base.Update(gameTime);
        }