Пример #1
0
        public void UpdatePathFinderMapCoords()
        {
            var basePoint = (MapBlock.BlockId - World.TheWorld.AvatarBlockId + LiveMap.ActiveQpoint) * Constants.MAP_BLOCK_SIZE;

            foreach (var point in LiveCoords.GetAllBlockPoints())
            {
                var pnt = basePoint + BaseMapBlock.GetInBlockCoords(point);
                m_liveMap.Cells[point.X, point.Y].PathMapCoords = pnt;
            }
        }
Пример #2
0
		public virtual void AddedToBlock(BaseMapBlock _mapBlock)
		{
			BlockId = _mapBlock.BlockId;
			WorldRoomRectangle = new Rct
				(
				RoomRectangle.Left + BlockId.X*Constants.MAP_BLOCK_SIZE,
				RoomRectangle.Top + BlockId.Y*Constants.MAP_BLOCK_SIZE,
				RoomRectangle.Width,
				RoomRectangle.Height);
			RandomSeed = _mapBlock.RandomSeed + RoomRectangle.LeftTop.GetHashCode();
		}
Пример #3
0
 public virtual void AddedToBlock(BaseMapBlock _mapBlock)
 {
     BlockId            = _mapBlock.BlockId;
     WorldRoomRectangle = new Rct
                          (
         RoomRectangle.Left + BlockId.X * Constants.MAP_BLOCK_SIZE,
         RoomRectangle.Top + BlockId.Y * Constants.MAP_BLOCK_SIZE,
         RoomRectangle.Width,
         RoomRectangle.Height);
     RandomSeed = _mapBlock.RandomSeed + RoomRectangle.LeftTop.GetHashCode();
 }
Пример #4
0
        public static void Fill(this BaseMapBlock _block, Random _rnd, WorldLayer _layer, IEnumerable <ETerrains> _defaultTerrains, Rct _rct)
        {
            var def = _defaultTerrains.ToArray();

            for (var i = 0; i < _rct.Width; ++i)
            {
                for (var j = 0; j < _rct.Height; ++j)
                {
                    _block.Map[i + _rct.Left, j + _rct.Top] = def.RandomItem(_rnd);
                }
            }
        }
Пример #5
0
 public MapBlock(Point _blockId, BaseMapBlock _baseMapBlock) : this(_blockId)
 {
     foreach (var point in Rect.AllPoints)
     {
         Map[point.X, point.Y] = _baseMapBlock.Map[point.X, point.Y];
     }
     foreach (var room in _baseMapBlock.Rooms)
     {
         Rooms.Add(room);
     }
     RandomSeed = _baseMapBlock.RandomSeed;
 }
Пример #6
0
		public MapBlock(Point _blockId, BaseMapBlock _baseMapBlock) : this(_blockId)
		{
			foreach (var point in Rect.AllPoints)
			{
				Map[point.X, point.Y] = _baseMapBlock.Map[point.X, point.Y];
			}
			foreach (var room in _baseMapBlock.Rooms)
			{
				Rooms.Add(room);
			}
			RandomSeed = _baseMapBlock.RandomSeed;
		}
Пример #7
0
 public static void Clear(this BaseMapBlock _block, Random _rnd, WorldLayer _layer, IEnumerable <ETerrains> _defaultTerrains)
 {
     Fill(_block, _rnd, _layer, _defaultTerrains, BaseMapBlock.Rect);
 }
Пример #8
0
        private Point GetCenterLiveCell()
        {
            var inBlock = BaseMapBlock.GetInBlockCoords(World.TheWorld.Avatar.GeoInfo.WorldCoords);

            return(CenterLiveBlock * Constants.MAP_BLOCK_SIZE + inBlock);
        }