Beispiel #1
0
        public override void LoadContent()
        {
            base.LoadContent();

            _content = new ContentManager(ScreenManager.Instance.Content.ServiceProvider, "Content");

            XmlManager<Player> playerLoader = new XmlManager<Player>();
            _player = playerLoader.Load("Content/Data/Gameplay/Player.xml");
            _player.LoadContent();

            _alterverse = new Alterverse(OnAlternativeChange);
            _alterverse.LoadContent();

            _levelView = new LevelView(_alterverse.CurrentLevel);
            _levelView.LoadContent();

            _alterIcons = new List<AlternativeIcon>();
            AlternativeIcon altIcon = new AlternativeIcon(new Vector2(100, 50), "1");
            altIcon.LoadContent();
            altIcon.IsActive = true;
            _alterIcons.Add(altIcon);

            //XmlManager<Map> mapLoader = new XmlManager<Map>();
            //_map = mapLoader.Load("Load/Gameplay/Maps/Map1.xml");
            //_map.LoadContent();

            _mouseState = Mouse.GetState();

            _accessedTiles = new List<Tile>();
        }
Beispiel #2
0
        public void Update(GameTime gameTime, ref Player player)
        {
            //_time += gameTime.ElapsedGameTime.TotalSeconds;
            //if(_time >= 5)
            //{
            //    _time = 0;

            //    int r = ScreenManager.Instance.Random.Next(1, 100);
            //    if(r >= 1 && r <= _chanse)
            //    {
            //        if (_onDestroy != null)
            //            _onDestroy(this);
            //    }
            //}

            //Rectangle tileRect = new Rectangle((int)Position.X, (int)Position.Y,
            //        _sourceRect.Width, _sourceRect.Height);
            ////Rectangle playerRect = new Rectangle((int)player.Image.Position.X, (int)player.Image.Position.Y,
            ////    player.Image.CollisionRect.Width, player.Image.CollisionRect.Height);

            //Rectangle playerRect = player.Image.CollisionRect;

            //if (playerRect.Intersects(tileRect))
            //{
            //    if(_state == "Solid")
            //    {

            //        if (player.Velocity.X < 0)
            //            player.Image.Position.X = tileRect.Right;
            //        else if (player.Velocity.X > 0)
            //            player.Image.Position.X = tileRect.Left - player.Image.CollisionRect.Width;

            //        if (player.Velocity.Y < 0)
            //            player.Image.Position.Y = tileRect.Bottom;
            //        else if (player.Velocity.Y > 0)
            //            player.Image.Position.Y = tileRect.Top - player.Image.CollisionRect.Height;

            //        player.Velocity = Vector2.Zero;
            //    }

            //    _chanse *= 20;

            //    int r = ScreenManager.Instance.Random.Next(1, 100);
            //    if (r >= 1 && r <= _chanse)
            //    {
            //        if (_onDestroy != null)
            //            _onDestroy(this);
            //    }
            //}
        }
Beispiel #3
0
        public void Update(GameTime gameTime, ref Player player)
        {
            for (int i=0; i < _underlayTiles.Count; i++)
                _underlayTiles[i].Update(gameTime, ref player);

            for (int i = 0; i < _overlayTiles.Count; i++)
                _overlayTiles[i].Update(gameTime, ref player);
        }