Example #1
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)
        {
            m_touch.UpdateMe();
            if (new Rectangle(m_p.Position.ToPoint(), new Point(TILESIZE, TILESIZE)).Intersects(
                    new Rectangle(m_map[0].m_WinPos.X * TILESIZE, m_map[0].m_WinPos.Y * TILESIZE, TILESIZE, TILESIZE)))
            {
                CurrentFloor++;
                GeneratingFloor++;

                m_manager.Join();
                m_map.RemoveAt(0);
                m_manager = new Thread(new ThreadStart(ThreadMap));
                m_manager.Start();
                m_p.Position        = new Vector2(m_map[0].m_StartPos.X * TILESIZE, m_map[0].m_StartPos.Y * TILESIZE);
                m_p.VirtualPosition = m_map[0].m_StartPos;
                m_minimap.UpdateMap(m_map[0]);
                if (CurrentFloor % TownNumber == 0)
                {
                    m_minimap.ShowAll();
                }
            }
            if (CurrentFloor % TownNumber != 0)
            {
                m_minimap.UpdateMe(gameTime, m_p, m_map[0]);
            }
            m_ui.UpdateMe(m_touch);
            if (PlayerTurn)
            {
                m_p.TakeTurn(m_ui);
            }
            m_p.UpdateMe(gameTime, m_map[0], m_ui, m_touch);

            m_map[0].UpdateMe(gameTime, m_p, m_touch);

            m_cam.UpdateMe(m_p.Position, new Point(TILESIZE * m_map[0].Map.GetLength(0), TILESIZE * m_map[0].Map.GetLength(1)));
            //m_cam.UpdateMe(m_touch.m_Touches[0].Position, new Point(0, 0));


            base.Update(gameTime);
        }