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); }
public void MouseMove(MouseEventArgs e, wallType type) { if (isMouseDown) { addToList(e, type); } }
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); }
private void btnGrass_Click(object sender, EventArgs e) { isBtnClick = true; type = wallType.grass; }
private void btnWater_Click(object sender, EventArgs e) { isBtnClick = true; type = wallType.water; }
private void btnSteel_Click(object sender, EventArgs e) { isBtnClick = true; type = wallType.steel; }
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; }
public void setWallType(wallType type) { this.type = type; }
public void MouseUp(MouseEventArgs e, wallType type) { isMouseDown = false; addToList(e, type); }
public void MouseDown(MouseEventArgs e, wallType type) { isMouseDown = true; addToList(e, type); }