コード例 #1
0
 /// <summary>
 /// Adds the elem to map.
 /// </summary>
 /// <param name="coord">The coord.</param>
 /// <param name="elem">The elem.</param>
 /// <returns></returns>
 public bool AddElemToMap(Point coord, MapElem elem)
 {
   try
   {
     _mapArray[coord.Y, coord.X] = elem;
     for (int i = 0; i < MapStatusString.Length; i++)
     {
       if (MapStatusString[i].IndexOf("\\" + Convert.ToString(elem.PictNumber) + "\\", 0, StringComparison.Ordinal) != -1)
       {
         _mapArray[coord.Y, coord.X].Status = (MapElemStatus)i;
         return true;
       }
     }
   }
   catch
   {
     return false;
   }
   return false;
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Map"/> class.
 /// Using in Map Editor
 /// </summary>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 public Map(int width, int height)
 {
   Width = VisibleXFinish = width;
   Height = VisibleYFinish = height;
   VisibleXStart = 0;
   VisibleYStart = 0;
   _mapArray = new MapElem[height, width];//[lines,columns]
   _start = new Point(-1, -1);
   _finish = new Point(-1, -1);
   Way = new List<Point>();
   _scaledBitmaps = new Bitmap[Bitmaps.Length];
   RebuildBitmaps();
   for (int i = 0; i < height; i++)
     for (int j = 0; j < width; j++)
       _mapArray[i, j] = new MapElem(1, 0, MapElemStatus.CanBuild);
 }