예제 #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;
     }
 }
예제 #2
0
 public static PressurePlate ReadPressurePlate(BinaryReader reader, LevelEditState l)
 {
     PressurePlate p = new PressurePlate(new BoundingBox(), l, null, null);
     p.MinX = reader.ReadSingle();
     p.MinY = reader.ReadSingle();
     p.MaxX = reader.ReadSingle();
     p.MaxY = reader.ReadSingle();
     byte b = reader.ReadByte();
     if (b == 22)
         p.Sprite = l.importedTextures[reader.ReadInt16()];
     b = reader.ReadByte();
     if (b == 22)
         p.Name = reader.ReadString();
     return p;
 }