private void btnProperties_Click(object sender, EventArgs e) { Tile selected = Game1.selector.getSelected(); if (selected is EnemyTile) { MessageBox.Show("There is no property for enemys!"); return; } else if (selected is PropTile) { PropTile prop = (PropTile)selected; PropForm pform = new PropForm(game, prop); pform.Show(); return; } else if (selected is FanTile) { FanTile fan = (FanTile)selected; FanForm fanForm = new FanForm(game, fan); fanForm.Show(); return; } PropertyForm form = new PropertyForm(game, selected); form.Show(); }
public void addProp() { if (currentLayer == ELayer.MIDDLE) { PropTile t = new PropTile(camera.getCenterPos()); middle.Add(t); selector.setSelected(t); } }
private static void addProp(List <string> list) { list.Add("[Props]"); foreach (Tile t in Game1.middle) { if (t is PropTile) { Rectangle rec = t.getRecHit(); PropTile tile = (PropTile)t; list.Add(tile.getX() + ":" + tile.getY() + ":" + rec.X / DIVID + ":" + ((rec.Y * -1) - rec.Height) / DIVID + ":" + rec.Height / DIVID); } } }
private static void loadProp(String s) { string[] data = s.Split(':'); int xTex = int.Parse(data[0]); int yTex = int.Parse(data[1]); float x = float.Parse(data[2]) * MULTI; float y = (float.Parse(data[3]) * MULTI * -1) - PropTile.HEIGHT; float height = float.Parse(data[4]) * MULTI; PropTile tile = new PropTile(new Vector2(x, y)); tile.setRectangle((int)x, (int)y, (int)height, (int)height); tile.setPropTexture(xTex, yTex); Game1.middle.Add(tile); }
public PropForm(Game1 game, PropTile tile) { this.game = game; this.tile = tile; InitializeComponent(); }