Exemple #1
0
        public Area GetAreaByCoords(WorldPosition coords)
        {
            if (!Data.Data.Areas.ContainsKey(coords.MapId))
                return null;

            return (from area in Data.Data.Areas[coords.MapId] from section in area.Sections where section.Polygon.Contains(coords.ToPoint3D()) select area).FirstOrDefault();
        }
Exemple #2
0
        public Section GetSectionByCoords(WorldPosition coords)
        {
            Area area = GetAreaByCoords(coords);

            if (area == null)
                return null;

            Section s = null;

            foreach (Section section in area.Sections)
            {
                if (!section.Polygon.Contains(coords.ToPoint3D()))
                    continue;

                foreach (var section1 in section.Sections)
                    if (section1.Polygon.Contains(coords.ToPoint3D()))
                        if (s == null || section1.Priority > s.Priority)
                            s = section1;

                return s ?? section;
            }

            return null;
        }