Example #1
0
        public async Task <IEnumerable <MapObject> > GetAllMovingObjectsAsync()
        {
            var map    = mapFactory.GetMap();
            var models = await objects.Find(data => data.IsMoving).ToListAsync();

            return(models.Select(model => new MapObject(model, map)).ToList());
        }
Example #2
0
        private void LoadSegmentData()
        {
            var map = mapFactory.GetMap();
            var x   = objectJson.Value <float>("Location.X");
            var y   = objectJson.Value <float>("Location.Y");

            objectSegment = map[x, y];
        }
Example #3
0
        public Task <JObject> GetJsonAsync()
        {
            var map    = factory.GetMap();
            var result = new { Segments = new { Width = map.SegmentsWidth, Height = map.SegmentsHeight } };
            var json   = JObject.FromObject(result);

            return(Task.FromResult(json));
        }
Example #4
0
 public SegmentQuery(IMongoDatabase mapDatabase, IMapFactory factory, float x, float y)
     : this(mapDatabase)
 {
     getStrategy = () =>
     {
         var map = factory.GetMap();
         return(map[x, y]);
     };
 }
Example #5
0
 public SegmentQuery(IMongoDatabase mapDatabase, IMapFactory factory, int i, int j)
     : this(mapDatabase)
 {
     getStrategy = () =>
     {
         var map = factory.GetMap();
         return(map[i, j]);
     };
 }
Example #6
0
 private void CreateMap()
 {
     map = factory.GetMap();
 }
Example #7
0
        private void CreateMapObject()
        {
            var map = mapFactory.GetMap();

            mapObject = new MapObject(id, map);
        }