Exemplo n.º 1
0
 ///fournir list<Sprite>, Sprite, Sprite, list<Sprite>
 /// <summary>
 /// Charge le jeu
 /// </summary>
 /// <param name="entityList">La liste des entités</param>
 /// <param name="map">La carte</param>
 /// <param name="hud">Le HUD</param>
 /// <param name="buttonList">La liste des boutons</param>
 /// <param name="pool">Le pool d'objet à dessiner</param>
 public void loadGame(List<Sprite> entityList, Sprite map, Sprite hud, PlayerInfo pi, List<Sprite> buttonList, out Pool pool)
 {
     batch = new SpriteBatch(graphics.GraphicsDevice);
     _pool = new Pool(ref this.content);
     _pool.loadMap(map);
     Rectangle r_map = _pool.getMap().getSprite().Bounds;
     PointConverter.Height = r_map.Height;
     PointConverter.Width = r_map.Width;
     _pool.loadHUD(hud);
     _pool.loadFonts();
     this._pi = pi;
     foreach (Sprite entity in entityList)
     {
         Point real_loc = PointConverter.ToClientPoint(new Point((int)entity.ServerLoc.X, entity.ServerLoc.Y));
         _pool.loadEntity(entity);
         _pool.getEntities().Last().Location = new Point((int)entity.ServerLoc.X, entity.ServerLoc.Y);
         _pool.getEntities().Last().Position = new Vector2((float)-real_loc.X, (float)-real_loc.Y);
     }
     foreach (Sprite button in buttonList)
     {
         _pool.loadButton(button);
     }
     pool = this._pool;
 }