示例#1
0
 public void create_place(int x, int y, int x2, int y2)
 {
     for (int i = x; i <= x2; i++)
     {
         for (int o = y; o <= y2; o++)
         {
             position = new Worldposition(i, o);
             listtetragon.Add(new Tetragon(position));
         }
     }
 }
示例#2
0
 //lower left and upper right Tetragons of wall
 public void create_long_wall(int x, int y, int x2, int y2)
 {
     if (Math.Abs(y - y2) + 1 == 2)
     {
         for (int i = x; i <= x2; i++)
         {
             listwall.Add(new Wall(new Tetragon(position = new Worldposition(i, y)), new Tetragon(position = new Worldposition(i, y + 1))));
         }
     }
     else
     {
         for (int o = y; o <= y2; o++)
         {
             listwall.Add(new Wall(new Tetragon(position = new Worldposition(x, o)), new Tetragon(position = new Worldposition(x + 1, o))));
         }
     }
 }
示例#3
0
        public void start()
        {
            ///////////////////////////////////////////TETRAGON//////////////////////////////////////////////////////////////////////////
            using (StreamReader sr = new StreamReader(path + ".txt", System.Text.Encoding.Default))
            {
                string        line;
                int           i        = 0;
                bool          flag     = false;
                Worldposition position = new Worldposition(0, 0);
                while ((line = sr.ReadLine()) != null)
                {
                    if (flag == false)
                    {
                        listtetragon.Add(new Tetragon(position));
                        listtetragon[i].setx(Convert.ToInt32(line));
                        flag = true;
                    }
                    else
                    {
                        listtetragon[i].sety(Convert.ToInt32(line));
                        flag = false;
                        i++;
                    }
                }
            }
            /////////////////////////////////////////////WALLL/////////////////////////////////////////////////////
            using (StreamReader sr = new StreamReader(path + "wall" + ".txt", System.Text.Encoding.Default))
            {
                string        line;
                int           i        = 0;
                int           flag     = 0;
                Worldposition position = new Worldposition(0, 0);
                while ((line = sr.ReadLine()) != null)
                {
                    switch (flag)
                    {
                    case 0:
                        listwall.Add(new Wall(new Tetragon(position = new Worldposition(0, 0)), new Tetragon(position = new Worldposition(0, 0))));
                        listwall[i].tetragon1.setx(Convert.ToInt32(line));
                        flag++;
                        break;

                    case 1:
                        listwall[i].tetragon1.sety(Convert.ToInt32(line));
                        flag++;
                        break;

                    case 2:
                        listwall[i].tetragon2.setx(Convert.ToInt32(line));
                        flag++;
                        break;

                    case 3:
                        listwall[i].tetragon2.sety(Convert.ToInt32(line));
                        flag = 0;
                        i++;
                        break;
                    }
                }
            }
            ////////////////////////////////////////////////////HEROES//////////////////////////////////////////
            using (StreamReader sr = new StreamReader(path + "heroes" + ".txt", System.Text.Encoding.Default))
            {
                string line;
                int    i    = 0;
                int    flag = 0;
                while ((line = sr.ReadLine()) != null)
                {
                    switch (flag)
                    {
                    case 0:
                        listheroes.Add(new Hero());
                        listheroes[i].name = line;
                        flag++;
                        break;

                    case 1:
                        listheroes[i].hp = Convert.ToInt32(line);
                        flag++;
                        break;

                    case 2:
                        listheroes[i].ap = Convert.ToInt32(line);
                        i++;
                        flag = 0;
                        break;
                    }
                }
            }
        }
示例#4
0
 public void setposition(Worldposition position)
 {
     this.position = position;
 }
示例#5
0
 public Tetragon(Worldposition position)
 {
     this.position = position;
 }
示例#6
0
 public void create_wall(int x, int y, int x2, int y2)
 {
     //  listtetragon.Add(new Tetragon(position = new MyMath.Worldposition (x,y)));
     //   listtetragon.Add(new Tetragon(position = new MyMath.Worldposition(x2,y2)));
     listwall.Add(new Wall(new Tetragon(position = new Worldposition(x, y)), new Tetragon(position = new Worldposition(x2, y2))));
 }
示例#7
0
 public void create_tetragon(int x, int y)
 {
     position = new Worldposition(x, y);
     listtetragon.Add(new Tetragon(position));
 }