/// <summary> /// This button will set the level's background. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBackground_Click(object sender, EventArgs e) { try { Doodad d = new Doodad(null, new Vector2(0, 0)); lstBackgrounds.Items.Add(d); state.background.Add(d); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnCreateBlock_Click(object sender, EventArgs e) { switch ((DrawableType)cbxBlockTypes.SelectedItem) { case DrawableType.controlPanel: ControlPanel controlPanel = new ControlPanel(new BoundingBox(new Vector3(0, 0, 0), new Vector3(20, 20, 0)), state, null, null); lstBlocks.Items.Add(controlPanel); state.interactables.Add(controlPanel); break; case DrawableType.elevatorSurface: ElevatorSurface elevatorSurface = new ElevatorSurface(new BoundingBox(new Vector3(0, 0, 0), new Vector3(20, 50, 0)), state, null, true, new Vector2(10, 50), new Vector2(10, 0)); lstBlocks.Items.Add(elevatorSurface); state.interactables.Add(elevatorSurface); break; case DrawableType.hangingLedge: HangingLedge hangingLedge = new HangingLedge(new BoundingBox(new Vector3(0, 0, 0), new Vector3(20, 20, 0)), state, null, new Microsoft.Xna.Framework.Point(20, 0), true); lstBlocks.Items.Add(hangingLedge); state.interactables.Add(hangingLedge); break; case DrawableType.movingHangingLedge: MovingHangingLedge movingHangingLedge = new MovingHangingLedge(new BoundingBox(new Vector3(0, 0, 0), new Vector3(20, 20, 0)), state, null, new Microsoft.Xna.Framework.Point(20, 0), true); lstBlocks.Items.Add(movingHangingLedge); state.interactables.Add(movingHangingLedge); break; case DrawableType.movingPlatform: MovingPlatform movingPlatform = new MovingPlatform(new BoundingBox(new Vector3(0, 0, 0), new Vector3(50, 50, 0)), state, new Microsoft.Xna.Framework.Point(25, 25), new Microsoft.Xna.Framework.Point(75, 25), MovingPlatformRotationType.Bouncing); lstBlocks.Items.Add(movingPlatform); state.walls.Add(movingPlatform); break; case DrawableType.pressurePlate: PressurePlate pressurePlate = new PressurePlate(new BoundingBox(new Vector3(0, 0, 0), new Vector3(50, 25, 0)), state, null, null); lstBlocks.Items.Add(pressurePlate); state.interactables.Add(pressurePlate); break; case DrawableType.rust: Rust rust = new Rust(new BoundingBox(new Vector3(0, 0, 0), new Vector3(50, 50, 0)), state); lstBlocks.Items.Add(rust); state.walls.Add(rust); break; case DrawableType.slope: Slope slope = new Slope(state, new Microsoft.Xna.Framework.Point(0, 50), new Microsoft.Xna.Framework.Point(50, 0)); lstBlocks.Items.Add(slope); state.walls.Add(slope); break; case DrawableType.wall: Wall wall = new Wall(new BoundingBox(new Vector3(0, 0, 0), new Vector3(50, 50, 0)), state); wall.Sprite = state.wall; lstBlocks.Items.Add(wall); state.walls.Add(wall); break; case DrawableType.doodad: Doodad doodad = new Doodad(null, new Vector2(0, 0)); lstBlocks.Items.Add(doodad); state.doodads.Add(doodad); break; case DrawableType.animatedDoodad: AnimatedDoodad animatedDoodad = new AnimatedDoodad(null, 50, 50, 2, 1, true, 1000, new Vector2(0, 0)); lstBlocks.Items.Add(animatedDoodad); state.doodads.Add(animatedDoodad); break; } }
public void AddToBackground(Doodad d) { lstBackgrounds.Items.Add(d); }
public static Doodad ReadDoodad(BinaryReader reader, LevelEditState l) { Doodad d = new Doodad(l.importedTextures[0], new Vector2(0,0)); d.PosX = reader.ReadSingle(); d.PosY = reader.ReadSingle(); byte b = reader.ReadByte(); if(b == 22) d.Sprite = l.importedTextures[reader.ReadInt16()]; b = reader.ReadByte(); if (b == 22) d.Name = reader.ReadString(); return d; }