Example #1
0
 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;
     }
 }
Example #2
0
 public static ControlPanel ReadControlPanel(BinaryReader reader, LevelEditState l)
 {
     ControlPanel c = new ControlPanel(new BoundingBox(Vector3.Zero, Vector3.Zero), l, null, null);
     c.MinX = reader.ReadSingle();
     c.MinY = reader.ReadSingle();
     c.MaxX = reader.ReadSingle();
     c.MaxY = reader.ReadSingle();
     byte b = reader.ReadByte();
     if (b == 22)
         c.Sprite = l.importedTextures[reader.ReadInt16()];
     b = reader.ReadByte();
     if (b == 22)
         c.Name = reader.ReadString();
     return c;
 }