public void AddObject(IMappedItem o, string mapName, SectorCoordinates coordinates) { //ISectorMap sectorMap = _sectorMaps.SingleOrDefault(map => map.Name == mapName); //if (sectorMap != null) //{ // Sector sector = sectorMap.GetSector(coordinates); // if (sector != null) // { // lock (_itemLocations) // { // //_itemLocations.Add(o.Id, sector); // sector.AddItem(o); // //o.Location = sector.Location; // } // } //} }
public void MoveObject(IMappedItem o, SectorCoordinates toCoordinates) { //Sector sector = new Sector("", SectorCoordinates.None);//_itemLocations[o.Id]; //ISectorMap sectorMap = _sectorMaps.SingleOrDefault(map => map.Name == sector.Location.MapName); //Debug.Assert(sectorMap != null); //Sector toSector = sectorMap.GetSector(toCoordinates); //// check toSector is a valid destination //if (toSector != null) //{ // lock (_itemLocations) // { // sector.RemoveItem(o); // //_itemLocations[o.Id] = toSector; // toSector.AddItem(o); // //o.Location = sector.Location; // } //} }
public void AddObject(IMappedItem item, SectorCoordinates coordinates) { Sector sector = Sectors.SingleOrDefault(x => x.Coordinates == coordinates); if (sector != null) { lock (_trackedItems) // later check if locking is necessary. could be handled at a higher level. { _trackedItems.Add(item.Id, item); _itemLocations.Add(item.Id, sector.Id); } } }
public void MoveObject(IMappedItem item, SectorCoordinates toCoordinates) { Sector sector = Sectors.SingleOrDefault(x => x.Coordinates == toCoordinates); if (sector != null && _trackedItems.ContainsKey(item.Id)) // && toCoordinates are not same as current? { lock (_trackedItems) // later check if locking is necessary. could be handled at a higher level. { _itemLocations[item.Id] = sector.Id; } } }
public void MoveObject(IMappedItem o, string toMapName, SectorCoordinates toCoordinates) { throw new NotImplementedException(); }