Exemple #1
0
        static float m; //The standard form (y=mx+b) of the line representing the incoming trajectory.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="l">The level to which this block belongs.</param>
        /// <param name="s">The leftmost point of the slope.</param>
        /// <param name="e">The rightmost point of the slope.</param>
        public Slope(LevelState l, Point s, Point e)
        {
            level = l;
            height = 33; //This is the minimum height of a slope. NOTE: This should be made configurable
            start = s;
            end = e;
            calculateSlopeIntercept();
            float X; //Max x
            float x; //Min X
            float Y; //Max y
            float y; //Min y
            if (s.X < e.X)
            {
                x = s.X;
                X = e.X;
            }
            else
            {
                x = e.X;
                X = s.X;
            }
            if (s.Y < e.Y)
            {
                y = s.Y;
                Y = e.Y;
            }
            else
            {
                y = e.Y;
                Y = s.Y;
            }
            dimensions = new BoundingBox(new Vector3(x, y, 0), new Vector3(X, Y, 0));
        }
        Delegate target; //The method that interacting with this object will invoke.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="b">The hit box of this object.</param>
        /// <param name="l">The level this belongs to.</param>
        /// <param name="s">The sprite for this object</param>
        /// <param name="target">The method this object will dynamically invoke.</param>
        /// <param name="sprite">Why is there another sprite? Was this an oversight? Investigate.</param>
        public PressurePlate(BoundingBox b, LevelState l, Texture2D s, Delegate target)
            : base(b, l, s)
        {
            level = l;
            hitBox = b;
            this.target = target;
            this.sprite = s;
        }
Exemple #3
0
        Delegate target; //The method which this interactable will dynamically invoke

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="b">The hit box for this object</param>
        /// <param name="l">The level this belongs to</param>
        /// <param name="s">The sprite for this object</param>
        /// <param name="target">The method this will dynamically invoke</param>
        /// <param name="sprite">Is this required? See pressureplate</param>
        public ControlPanel(BoundingBox b, LevelState l, Texture2D s, Delegate target)
            : base(b, l, s)
        {
            hitBox = b;
            level = l;
            this.target = target;
            this.Sprite = s;
        }
Exemple #4
0
        protected Boolean isRight; //True if the hanging point is on the left side of the wall, otherwise false.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="b">The area where the player can begin hanging from.</param>
        /// <param name="l">The level this belongs to.</param>
        /// <param name="s">The sprite for this object.</param>
        /// <param name="p">The hanging point.</param>
        /// <param name="r">True if this is on the left side of a wall, otherwise false.</param>
        public HangingLedge(BoundingBox b, LevelState l, Texture2D s, Point p, Boolean r)
            : base(b, l, s)
        {
            level = l;
            hitBox = b;
            hangPoint = p;
            isRight = r;
        }
        protected Vector2 velocity; //The velocity of this object

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Standard constructor.
        /// </summary>
        /// <param name="b">This object's hit box.</param>
        /// <param name="l">The level this belongs to.</param>
        /// <param name="s">The sprite to use to draw this object.</param>
        /// <param name="p">The hanging point.</param>
        /// <param name="r">True if this object is on the left side of something, otherwise false.</param>
        public MovingHangingLedge(BoundingBox b, LevelState l, Texture2D s, Point p, Boolean r)
            : base(b, l, s, p, r)
        {
            position = new Vector2();
            position.X = p.X;
            position.Y = p.Y;
            velocity = new Vector2(0, 0);
        }
Exemple #6
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);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="dimensions">The hitbox of this block, and its dimensions.</param>
 /// <param name="l">The level to which this block belongs.</param>
 /// <param name="begin">The point where the movement of this block begins.</param>
 /// <param name="end">The point where the movement of this block ends.</param>
 /// <param name="rotationType">The type of rotation for this moving platform.</param>
 /// <param name="secondsPerCycle">Number of seconds from point a to b</param>
 /// <param name="runningHoriz">True if there is a horizontal component to this platform's speed.</param>
 /// <param name="runningVert">True if there is a vertical component to this platform's speed.</param>
 public MovingPlatform(BoundingBox dimensions, LevelState l, Point begin, Point end, MovingPlatformRotationType rotationType, float secondsPerCycle, Boolean runningHoriz, Boolean runningVert)
     : base(dimensions, l)
 {
     trajectorySet = false;
     this.dimensions = dimensions;
     difference = new Vector2();
     this.secondsPerCycle = secondsPerCycle;
     this.begin = begin;
     this.end = end;
     this.rotationType = rotationType;
     isDown = true;
     isRight = true;
     setAnimator = true;
     calculateLength();
     calculateSpeed();
     height = dimensions.Max.Y - dimensions.Min.Y;
     width = dimensions.Max.X - dimensions.Min.X;
 }
Exemple #8
0
 public Swarmbot(Texture2D s, List<LevelBlock> walls, LevelState l)
     : base(s, walls, l)
 {
 }
Exemple #9
0
 public Minibot(Texture2D s, List<LevelBlock> walls, LevelState l)
     : base(s, walls, l)
 {
     isActive = false;
 }
Exemple #10
0
 public Rust(BoundingBox b, LevelState l, double t, Texture2D sprite)
     : base(b, l)
 {
     disappearTime = t;
     this.sprite = sprite;
 }
Exemple #11
0
 /// <summary>
 /// This constructor allows you to set the length of time the rust will remain on screen before disappearing.
 /// </summary>
 /// <param name="b">The dimensions of the block.</param>
 /// <param name="l">The level to which this block belongs.</param>
 /// <param name="t">The number of milliseconds from when this is collided with until it disappears.</param>
 public Rust(BoundingBox b, LevelState l, double t)
     : base(b, l)
 {
     disappearTime = t;
 }
Exemple #12
0
        protected double disappearTime = 0; //Number of milliseconds since this started disappearing.

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Default constructor. This will initialize disappearLength to 1500 milliseconds.
        /// </summary>
        /// <param name="b">The dimensions of the block.</param>
        /// <param name="l">The level to which this block belongs.</param>
        public Rust(BoundingBox b, LevelState l)
            : base(b, l)
        {
            disappearLength = 1500;
        }