Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Cities.Library.Model.Building"/> class.
 /// </summary>
 /// <param name="position">Position.</param>
 /// <param name="size">Size.</param>
 public Building(Position position, Size size)
 {
     Position = position;
     Size = size;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Cities.Library.Model.Building"/> class.
 /// </summary>
 /// <param name="x">The x coordinate.</param>
 /// <param name="y">The y coordinate.</param>
 /// <param name="width">Width.</param>
 /// <param name="height">Height.</param>
 /// <param name="length">Length.</param>
 public Building(double x, double y, double width, double height, double length)
 {
     Position = new Position(x, y);
     Size = new Size(width, height, length);
 }
 private static Position GeneratePosition(bool u, ref double currentUp, ref double currentDown, ref double currentLeft, ref double currentRigth, int direction, Size size, Position position)
 {
     switch (direction)
     {
         case 1:
             if (u)
             {
                 currentUp += size.Width;
                 return new Position(position.X + currentUp - size.Width, position.Y+size.Length);
             }
             else
             {
                 currentDown += size.Width;
                 return new Position(position.X+ currentDown - size.Width, position.Y);
             }
             break;
         case 2:
             if (u)
             {
                 currentLeft += size.Length;
                 return new Position(position.X - size.Width, position.Y + currentLeft - size.Length);
             }
             else
             {
                 currentRigth += size.Length;
                 return new Position(position.X, position.Y + currentRigth - size.Length);
             }
             break;
         case 3:
             if (u)
             {
                 currentUp += size.Width;
                 return new Position(position.X - currentUp - size.Width, position.Y+size.Length);
             }
             else
             {
                 currentDown += size.Width;
                 return new Position(position.X - currentDown - size.Width, position.Y);
             }
             break;
         case 4:
             if (u)
             {
                 currentLeft += size.Length;
                 return new Position(position.X - size.Width, position.Y - currentLeft - size.Length);
             }
             else
             {
                 currentRigth += size.Length;
                 return new Position(position.X, position.Y - currentRigth - size.Length);
             }
             break;
         default:
             return null;
     }
 }