Exemplo n.º 1
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            for (int y = 0; y < SizeY; y++)
            {
                for (int x = 0; x < SizeX; x++)
                {
                    sb.Append(TileStates[x, y] == TileState.Blocked ? "x" : FloorHeight.ToString());
                }

                sb.Append(Convert.ToChar(13));
            }

            return(sb.ToString());
        }
Exemplo n.º 2
0
 private void SetHeights()
 {
     floorHeight = new FloorHeight();
     if (floors == null)
     {
         floors = new List <Floor>();
     }
     if (height <= 0)
     {
         throw new Exception("building height not set");
     }
     if (height > 0)
     {
         float h       = 6;
         int   counter = 0;
         while (h <= height)
         {
             floorHeight.heights.Add(h);
             h       += 3;
             counter += 1;
         }
     }
     if (floorHeight.Count > 0)
     {
         int dif = floors.Count - floorHeight.Count;
         if (dif > 0)
         {
             for (int i = 0; i < dif; i++)
             {
                 int index = floors.Count - 1;
                 floors[index].Destroy();
                 floors.RemoveAt(index);
             }
         }
         else
         {
             for (int i = 0; i < -dif; i++)
             {
                 floors.Add(new Floor());
             }
         }
     }
 }