internal void ViewProActiveRegionUpdate(SimulationEvent ev) { String id = ((StringValue)ev["ObjectID"]).value; SimActiveRegion ar = null; int displayColor = ((IntegerValue)ev["DisplayColor"]).value; if (m_activeRegions.ContainsKey(id)) { ar = m_activeRegions[id]; ar.Shape = ((PolygonValue)ev["Shape"]); ar.Color = Color.FromArgb(displayColor); } else { ar = new SimActiveRegion(); ar.ID = id; ar.Shape = ((PolygonValue)ev["Shape"]); ar.Color = Color.FromArgb(displayColor); } m_activeRegions[ar.ID] = ar; if (PlayerAgent != null) { PlayerAgent.ViewProActiveRegionUpdate(ev); } }
public void Update(DDDServerConnection serverConnection, DMView dmView) { SimObject me = dmView.AllObjects[m_thisID]; SimActiveRegion zone = dmView.ActiveRegions[m_zoneID]; LocationValue otherLocation = null; Polygon2D azPoly = new Polygon2D(); foreach (PolygonValue.PolygonPoint p in zone.Shape.points) { azPoly.AddVertex(new Vec2D(p.X, p.Y)); } bool clear = true; foreach (String id in dmView.AllObjects.Keys) { if (id == m_thisID) { continue; } otherLocation = dmView.AllObjects[id].Location; if (Polygon2D.IsPointInside(azPoly, new Vec2D(otherLocation))) { clear = false; break; } } if (clear) { m_done = true; } }