Beispiel #1
0
        public IMap Clone()
        {
            TCODMap map = new TCODMap(Width, Height);

            map.copy(TCODMap);
            return(new LibtcodMap(map));
        }
Beispiel #2
0
        public bool PlaceAt(int x, int y, Map map)
        {
            if (x >= 0 && x < Map.MAP_WIDTH &&
                y >= 0 && y < Map.MAP_HEIGHT)
            {
                if (!_isOnMap || map != _currentMap)
                {
                    if (_currentMap != null)
                    {
                        _currentMap.RemoveLight(this);
                    }
                    _currentMap = map;
                    map.AddLight(this);
                    _tcodmap = new TCODMap(Map.MAP_WIDTH, Map.MAP_HEIGHT);
                    _tcodmap.copy(map.TCODMap);
                }
                PosX = x;
                PosY = y;
                _tcodmap.computeFov(PosX, PosY, _radius, true);
                _isOnMap = true;

                return(true);
            }
            return(false);
        }
        public void OnUpdate(TCODMap currentMap)
        {
            _currentMap.copy(currentMap);

            if (_currentPath == null)
            {
                return;
            }

            _currentPath.Dispose();
            _currentPath = new TCODPath(_currentMap, 1.14f);
            ComputePath(_currentX, _currentY, _destX, _destY);
        }
Beispiel #4
0
 public void Copy(IMap sourceMap, int left = 0, int top = 0)
 {
     if (sourceMap.Width + left > Width)
     {
         throw new ArgumentException("Source map 'width' + 'left' cannot be larger than the destination map width", "destinationMap");
     }
     if (sourceMap.Height + top > Height)
     {
         throw new ArgumentException("Source map 'height' + 'top' cannot be larger than the destination map height", "destinationMap");
     }
     if (sourceMap is LibtcodMap && left == 0 && top == 0)
     {
         LibtcodMap mapToCopyFrom = sourceMap as LibtcodMap;
         TCODMap.copy(mapToCopyFrom.TCODMap);
     }
     else
     {
         foreach (Cell cell in sourceMap.GetAllCells())
         {
             SetCellProperties(cell.X + left, cell.Y + top, cell.IsTransparent, cell.IsWalkable);
         }
     }
 }
Beispiel #5
0
 public IMap Clone()
 {
     TCODMap map = new TCODMap( Width, Height );
      map.copy( TCODMap );
      return new LibtcodMap( map );
 }
Beispiel #6
0
        public bool PlaceAt(int x, int y, Map map)
        {
            if (x >= 0 && x < Map.MAP_WIDTH
                && y >= 0 && y < Map.MAP_HEIGHT)
            {
                if (!_isOnMap || map != _currentMap)
                {
                    if (_currentMap != null)
                        _currentMap.RemoveLight(this);
                    _currentMap = map;
                    map.AddLight(this);
                    _tcodmap = new TCODMap(Map.MAP_WIDTH, Map.MAP_HEIGHT);
                    _tcodmap.copy(map.TCODMap);
                }
                PosX = x;
                PosY = y;
                _tcodmap.computeFov(PosX, PosY, _radius, true);
                _isOnMap = true;

                return true;
            }
            return false;
        }