/// <summary>
 /// Checks for collision with other bounding rectangle
 /// </summary>
 /// <param name="rectangle">Bounding rectangle to check collision with</param>
 /// <returns>True if there is a collision</returns>
 public bool Collides(BoundingRectangle rectangle)
 {
     return boundingRectangle.Intersects(rectangle.boundingRectangle);
 }
Beispiel #2
0
 /// <summary>
 /// Basic Constructor
 /// </summary>
 /// <param name="position">Position of the entity</param>
 /// <param name="x">Radius of the bounding box width</param>
 /// <param name="y">Radius of the bounding box height</param>
 public Entity(Vector2 position, float x, float y)
 {
     this.position = position;
     boundingBox = new BoundingRectangle(position, x, y);
 }
Beispiel #3
0
        /// <summary>
        /// Basic constructor
        /// </summary>
        /// <param name="position">Position of the burger</param>
        /// <param name="x">Radius in x for collision</param>
        /// <param name="y">Radius in y for collision</param>
        public BurgerPart(Vector2 position, float x, float y)
        {
            state = State.Static;

            float scale = SettingsManager.GetInstance().Scale;

            this.position = position;
            boundingBox = new BoundingRectangle(position, x, y);

            speed = 1.65f * scale;

            positions = new Vector2[4];
            positions[0] = this.position - new Vector2(56.5f * scale, 0);
            positions[1] = this.position - new Vector2(19f * scale, 0);
            positions[2] = this.position + new Vector2(19f * scale, 0);
            positions[3] = this.position + new Vector2(56.5f * scale, 0);

            boundingBoxes = new BoundingRectangle[4];
            boundingBoxes[0] = new BoundingRectangle(positions[0], 19 * scale, 15 * scale);
            boundingBoxes[1] = new BoundingRectangle(positions[1], 19 * scale, 15 * scale);
            boundingBoxes[2] = new BoundingRectangle(positions[2], 19 * scale, 15 * scale);
            boundingBoxes[3] = new BoundingRectangle(positions[3], 19 * scale, 15 * scale);

            touched = new bool[4] { false, false, false, false };

            numberOfRiders = 0;
            numberOfLevels = 0;

            lastTile = new int[2] { -50, -50 };
        }