Esempio n. 1
0
        public World(GameState gameState, Dictionary <string, Tile> tiles, int mondeid, bool dead)
        {
            _gameState           = gameState;
            _tmrRefresh.Interval = 2000;
            _tmrRefresh.Enabled  = true;
            _tmrRefresh.Elapsed += _tmrRefresh_Tick;
            _tiles = tiles;
            Classe currentclasse = Data.ClassController.GetListClasses(Data.WorldId).FirstOrDefault(c => c.Id == Data.ClassId);

            _currentHero = Data.HeroController.GetListHero(Data.UserId).First(c => c.Id == Data.CurrentHeroId);
            _heroClasse  = currentclasse.Description;
            //load la map
            CreerAreaDic(mondeid);
            //load les stat du hero
            UpdateGameState();

            //Find the start point
            _heroid = _currentHero.Id;
            //trouve l'area du hero
            int xarea = _currentHero.x / 8;
            int yarea = _currentHero.y / 8;

            _currentArea = _world[xarea.ToString() + "," + yarea.ToString()];

            _heroPosition = new Point(3, 3);

            //si mort, retourne debut full life
            if (dead)
            {
                _currentArea = _world["0,0"];

                Data.vie = Data.Stam * 10;
            }
            if (!dead)
            {
                //si pas mort, trouve pos
                _heroPosition.X = _currentHero.x % 8;
                _heroPosition.Y = _currentHero.y % 8;
            }

            //set sprite selon classe
            _heroSprite = new Sprite(null, _heroPosition.X * Tile.TileSizeX + Area.AreaOffsetX,
                                     _heroPosition.Y * Tile.TileSizeY + Area.AreaOffsetY,
                                     _tiles[_heroClasse].Bitmap, _tiles[_heroClasse].Rectangle, _tiles[_heroClasse].NumberOfFrames);

            //affiche nom
            _popups.Add(new textPopup((int)_heroSprite.Location.X, (int)_heroSprite.Location.Y + 100, Data.HeroName));

            _heroSprite.Flip     = true;
            _heroSprite.ColorKey = Color.FromArgb(75, 75, 75);
            _tmrRefresh.Start();
        }
Esempio n. 2
0
        public World(GameState gameState, Dictionary<string, Tile> tiles, int mondeid, bool dead)
        {
            _gameState = gameState;
            _tmrRefresh.Interval = 2000;
            _tmrRefresh.Enabled = true;
            _tmrRefresh.Elapsed += _tmrRefresh_Tick;
            _tiles = tiles;
            Classe currentclasse = Data.ClassController.GetListClasses(Data.WorldId).FirstOrDefault(c=> c.Id == Data.ClassId);
            _currentHero = Data.HeroController.GetListHero(Data.UserId).First(c => c.Id == Data.CurrentHeroId);
            _heroClasse = currentclasse.Description;
            //load la map
            CreerAreaDic(mondeid);
            //load les stat du hero
            UpdateGameState();

            //Find the start point
            _heroid = _currentHero.Id;
            //trouve l'area du hero
            int xarea = _currentHero.x / 8;
            int yarea = _currentHero.y / 8;

            _currentArea = _world[xarea.ToString() + "," + yarea.ToString()];
            
            _heroPosition = new Point(3, 3);

            //si mort, retourne debut full life
            if (dead)
            {
               _currentArea = _world["0,0"];

                Data.vie = Data.Stam * 10;
            }
            if (!dead)
            {
                //si pas mort, trouve pos
                _heroPosition.X = _currentHero.x % 8;
                _heroPosition.Y = _currentHero.y % 8;
            }

            //set sprite selon classe
            _heroSprite = new Sprite(null, _heroPosition.X * Tile.TileSizeX + Area.AreaOffsetX,
                                            _heroPosition.Y * Tile.TileSizeY + Area.AreaOffsetY,
                                            _tiles[_heroClasse].Bitmap, _tiles[_heroClasse].Rectangle, _tiles[_heroClasse].NumberOfFrames);
            
            //affiche nom
            _popups.Add(new textPopup((int)_heroSprite.Location.X, (int)_heroSprite.Location.Y +100, Data.HeroName));

            _heroSprite.Flip = true;
            _heroSprite.ColorKey = Color.FromArgb(75, 75, 75);
            _tmrRefresh.Start();
        }