Exemple #1
0
 /// <summary>
 /// Set the Zoning regulation for a given area defined by the points p1 and p2 at the corners of the area.
 /// </summary>
 /// <param name="p1">One corner of the area</param>
 /// <param name="p2">The corner opposite p2</param>
 /// <param name="z">The type of zone to set</param>
 public static bool SetZoning(Point p1, Point p2, Haswell.Zones z)
 {
     if (Initialized)
     {
         Point tl = new Point(System.Math.Min(p1.X, p2.X), System.Math.Min(p1.Y, p2.Y));
         Point br = new Point(System.Math.Max(p1.X, p2.X), System.Math.Max(p1.Y, p2.Y));
         Haswell.Controller.City.SetZoning(new System.Drawing.Point(tl.X, tl.Y), new System.Drawing.Point(br.X, br.Y), z);
         for (int x = tl.X; x <= br.X; ++x)
         {
             for (int y = tl.Y; y <= br.Y; ++y)
             {
                 if (!CityManager.Plots.ContainsKey(Haswell.Controller.City.Grid.ElementAt(x, y)))
                 {
                     RenderablePlot rp = new RenderablePlot(Haswell.Controller.City.Grid.ElementAt(x, y));
                     rp.Create(SceneMgr, cityNode);
                     CityManager.Plots[Haswell.Controller.City.Grid.ElementAt(x, y)] = rp;
                 }
             }
         }
         return(true);
     }
     else
     {
         GameConsole.ActiveInstance.WriteError("Unable to set zoning, no city initialized!");
     }
     return(false);
 }
Exemple #2
0
 public static bool SetZoning(Rectangle r, Haswell.Zones z)
 {
     return(SetZoning(r.Location, new Point(r.Right, r.Bottom), z));
 }
Exemple #3
0
 /// <summary>
 /// Set the Zoning regulation for a plot at the given coordinates
 /// </summary>
 /// <param name="p">Point to set the zoning of</param>
 /// <param name="z">The type of zone to set</param>
 public static bool SetZoning(Point p, Haswell.Zones z)
 {
     return(SetZoning(p, p, z));
 }