예제 #1
0
 //конструктор
 public CMap(int width, int height)
 {
     Width = width;
     Height = height;
     BMap = new CBasicMap(width, height);
     LMap = new CLocationMap(width, height);
     TMap = new CTimeoutMap(width, height);
 }
예제 #2
0
 public static CBasicMap ReadMapFromFile(string path)
 {
     BinaryReader r = new BinaryReader(File.OpenRead(path));
     int w = r.ReadInt32();
     int h = r.ReadInt32();
     CBasicMap map = new CBasicMap(w, h);
     for (int i = 0; i < w; i++)
         for (int j = 0; j < h; j++)
         {
             int k = r.ReadInt32();
             switch (k)
             {
                 case 0: map[i, j] = TypesOfField.NOTHING; break;
                 case 1: map[i, j] = TypesOfField.WALL; break;
                 case 2: map[i, j] = TypesOfField.BONUS; break;
                 case 3: map[i, j] = TypesOfField.MEDKIT; break;
                 case 8: map[i, j] = TypesOfField.ME; break;
                 case 9: map[i, j] = TypesOfField.HI; break;
             }
         }
     r.Close();
     return map;
 }