Ejemplo n.º 1
0
        public double time; //Calculated value, how long it takes to make one trip along the elevator surface.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="s">The sprite</param>
        /// <param name="walls">The list of level blocks in the level</param>
        /// <param name="l">The level this belongs to</param>
        public Elevatorbot(Texture2D s, List<LevelBlock> walls, LevelState l)
            : base(s, walls, l)
        {
            animatorSet = false;
            isElevating = false;
            attachedSurface = null;
            type = InteractorType.elevatorbot;
            platform = new MovingPlatform(new BoundingBox(), l, new Point(-1, -1), new Point(-1, -1), MovingPlatformRotationType.Bouncing);
            ledge = new MovingHangingLedge(new BoundingBox(), l, TextureLoader.grayblock, new Point(-1, -1), true);
        }
Ejemplo n.º 2
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;
     }
 }
Ejemplo n.º 3
0
 public static MovingPlatform ReadMovingPlatform(BinaryReader reader, LevelEditState l)
 {
     MovingPlatform m = new MovingPlatform(new BoundingBox(), l, new Microsoft.Xna.Framework.Point(), new Microsoft.Xna.Framework.Point(), MovingPlatformRotationType.Bouncing);
     m.MinX = reader.ReadSingle();
     m.MinY = reader.ReadSingle();
     m.MaxX = reader.ReadSingle();
     m.MaxY = reader.ReadSingle();
     m.BeginX = reader.ReadInt16();
     m.BeginY = reader.ReadInt16();
     m.EndX = reader.ReadInt16();
     m.EndY = reader.ReadInt16();
     m.SecondsPerCycle = reader.ReadSingle();
     byte b = reader.ReadByte();
     if (b == 22)
         m.Sprite = l.importedTextures[reader.ReadInt16()];
     b = reader.ReadByte();
     if (b == 22)
         m.Name = reader.ReadString();
     return m;
 }