Ejemplo n.º 1
0
    private void RemoveSector(byte arrayIndex)
    {
        RingSector rs = mapSectors[arrayIndex];

        if (rs != null)
        {
            if (rs.centralPoint != null)
            {
                RemovePoint(rs.centralPoint, true);
            }
            if (rs.innerPointsIDs.Count > 0)
            {
                MapPoint p = null;
                foreach (var mp in rs.innerPointsIDs)
                {
                    p = GetMapPointByID(mp.Value);
                    if (!p.DestructionTest())
                    {
                        RemovePoint(p, false);
                    }
                }
                rs.innerPointsIDs.Clear();
            }
            if (mapPoints.Count > 0)
            {
                int      x = arrayIndex, i = 0;
                MapPoint mp = null;
                while (i < mapPoints.Count)
                {
                    mp = mapPoints[i];
                    if (mp == null)
                    {
                        mapPoints.RemoveAt(i);
                        continue;
                    }
                    else
                    {
                        x = DefineSectorIndex(mp.angle, mp.ringIndex);
                        if (x == arrayIndex)
                        {
                            if (!mp.DestructionTest())
                            {
                                RemovePoint(mp, true);
                            }
                        }
                        i++;
                    }
                }
            }
            mapSectors[arrayIndex] = null;
            actionsHash++;
        }
    }