Example #1
0
        private void addToList(MouseEventArgs e, wallType type)
        {
            int x, y;

            transCoor(out x, out y, e.X, e.Y);
            wallList[x + y * 26] = Factory.createWall(type, x, y);
        }
Example #2
0
 public void MouseMove(MouseEventArgs e, wallType type)
 {
     if (isMouseDown)
     {
         addToList(e, type);
     }
 }
Example #3
0
 public static Wall createWall(wallType type, int x, int y)
 {
     if (wallType.wall == type)
     {
         return(new Wall(x * 30, y * 30, 30, 30, false, 1, wallType.wall));
     }
     else if (wallType.steel == type)
     {
         return(new Wall(x * 30, y * 30, 30, 30, false, 3, wallType.steel));
     }
     else if (wallType.grass == type)
     {
         return(new Wall(x * 30, y * 30, 30, 30, true, 1, wallType.grass));
     }
     else if (wallType.water == type)
     {
         return(new Wall(x * 30, y * 30, 30, 30, true, 1, wallType.water));
     }
     else if (wallType.home == type)
     {
         return(new Wall(x * 30, y * 30, 60, 60, false, 1, wallType.home));
     }
     return(null);
 }
Example #4
0
 private void btnGrass_Click(object sender, EventArgs e)
 {
     isBtnClick = true;
     type       = wallType.grass;
 }
Example #5
0
 private void btnWater_Click(object sender, EventArgs e)
 {
     isBtnClick = true;
     type       = wallType.water;
 }
Example #6
0
 private void btnSteel_Click(object sender, EventArgs e)
 {
     isBtnClick = true;
     type       = wallType.steel;
 }
Example #7
0
 public Wall(int x, int y, int width, int height, bool canPass, int hardness, wallType type) : base(x, y, width, height, canPass)
 {
     this.hardness = hardness;
     this.type     = type;
 }
Example #8
0
 public void setWallType(wallType type)
 {
     this.type = type;
 }
Example #9
0
 public void MouseUp(MouseEventArgs e, wallType type)
 {
     isMouseDown = false;
     addToList(e, type);
 }
Example #10
0
 public void MouseDown(MouseEventArgs e, wallType type)
 {
     isMouseDown = true;
     addToList(e, type);
 }