Aurora.Modules.CityBuilder.CityMap.MakePlot C# (CSharp) Метод

MakePlot() публичный Метод

Constructs a building plot for a given position, size and claim type, does not alter any internal properties, this is just a helper method that allows you to create building plots quickly for use as parameters to other internal/external methods that the class provides.
public MakePlot ( int x, int y, int w, int d, PlotClaimType flags ) : BuildingPlot
x int
y int
w int
d int
flags PlotClaimType
Результат BuildingPlot
        public BuildingPlot MakePlot(int x, int y, int w, int d, PlotClaimType flags)
        {
            BuildingPlot plot = new BuildingPlot();
            plot.XPos = x;
            plot.YPos = y;
            plot.Width = w;
            plot.Depth = d;
            plot.PlotClaimType = flags;
            return (plot);
        }

Usage Example

Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x1"></param>
        /// <param name="?"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        private void doRoad(int x1, int y1, int width, int depth)
        {
            int lanes;
            int divider;
            int sidewalk;

            if (width > depth)
            {
                lanes = depth;
            }
            else
            {
                lanes = width;
            }
            if (lanes < 4)
            {
                return;
            }
            bool odd = false;
            int  i   = (lanes % 2);

            if (i > 0)
            {
                odd = true;
            }
            if (odd)//lanes % 2)
            {
                lanes--;
                divider = 1;
            }
            else
            {
                divider = 0;
            }
            sidewalk  = 2;// MAX(2, (lanes - 10));
            lanes    -= sidewalk;
            sidewalk /= 2;
            lanes    /= 2;
            cityMap.ClaimPlot(cityMap.MakePlot(x1, y1, width, depth, PlotClaimType.CLAIM_NONE));
            if (width > depth)
            {
                cityMap.ClaimPlot(cityMap.MakePlot(x1, y1 + sidewalk, width, lanes, PlotClaimType.CLAIM_TRANSPORT));
                cityMap.ClaimPlot(cityMap.MakePlot(x1, y1 + sidewalk + lanes + divider, width, lanes, PlotClaimType.CLAIM_TRANSPORT));
            }
            else
            {
                cityMap.ClaimPlot(cityMap.MakePlot(x1 + sidewalk, y1, lanes, depth, PlotClaimType.CLAIM_TRANSPORT));
                cityMap.ClaimPlot(cityMap.MakePlot(x1 + sidewalk + lanes + divider, y1, lanes, depth, PlotClaimType.CLAIM_TRANSPORT));
            }
        }