예제 #1
0
파일: Level.cs 프로젝트: ilyushchenko/Tanks
 public void LoadLevel(string path)
 {
     using(StreamReader sr = new StreamReader(path))
     {
         m_n = Convert.ToInt32(sr.ReadLine());
         m_m = Convert.ToInt32(sr.ReadLine());
         while (!sr.EndOfStream)
         {
             string type = sr.ReadLine();
             ISerializable unit;
             switch (type)
             {
                 case "floor":
                     unit = new Floor();
                     break;
                 case "wall":
                     unit = new Wall();
                     break;
                 case "tank":
                     unit = new Tank();
                     break;
                 default:
                     unit = new Floor();
                     break;
             }
             unit.Load(sr);
             IPositionable positionOfUnit = unit as IPositionable;
             m_field[positionOfUnit.Position.X, positionOfUnit.Position.Y] = positionOfUnit;
         }
     }
 }
예제 #2
0
파일: Model.cs 프로젝트: sunloverz/Tanks
 public void NewGame()
 {
     projectile = new Projectile();
      packman = new Packman(sizeField);
      tanks = new List<Tank>();
      fireTank = new List<FireTank>();
      apples = new List<Apple>();
      collectedApples = 0;
      gameStatus = GameStatus.stopping;
      wall =new Wall();
      CreateTanks();
      CreateApples(0);
      step = -30;
 }
예제 #3
0
        private void CreateBorder()
        {
            for (int i = 0; i < m_n; i++)
            {
                m_field[i, 0] = new Wall(i, 0);
                m_field[i, m_m - 1] = new Wall(i, m_m - 1);
            }

            for (int i = 1; i < m_m - 1; i++)
            {
                m_field[0, i] = new Wall(0, i);
                m_field[m_n - 1, i] = new Wall(m_n - 1, i);
            }
        }
예제 #4
0
 public void CheckWall(int x, int y)
 {
     int curX = x / Width;
     int curY = y / Height;
     //int curX = (x - x % Width);
     //int curY = (y - y % Height);
     //Wall wall = new Wall(curX, curY);
     if (m_field[curX, curY] is Floor)
     {
         m_field[curX, curY] = new Wall(curX, curY);
     }
     else
     {
         m_field[curX, curY] = new Floor(curX, curY);
     }
 }
예제 #5
0
파일: Painter.cs 프로젝트: GOPbIHbI4/test
 //рисует стену
 public static void paint(Wall wall)
 {
     throw new NotImplementedException();
 }