Game-Design / Sprint3_actual / Blocks / ExitBlock.cs
ExitBlock.cs
Raw
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System;
using System.Collections.Generic;
using System.Text;
using Sprint3_actual.SpriteFactories;
using Sprint3_actual.Collision_Detection;
using Sprint3_actual.StateFiles;

namespace Sprint3_actual.Blocks
{
    class ExitBlock : IBlock
    {

        private ISprite sprite;
        private Rectangle posRectangle;
        private bool removed;
        private const int blockWH = 48;
        public ICollision side;
        public Vector2 MoveDirection;
        public Vector2 destination;

        public ExitBlock(int xPos, int yPos, int blockType)
        {
            this.removed = false;
            this.posRectangle = new Rectangle(xPos, yPos, blockWH, blockWH);
            if (blockType == 1)
            {
                sprite = BlockSpriteFactory.Instance.CreateBlock(3, this);
                destination = new Vector2(144, 48);
                MoveDirection = Vector2.UnitY;
                side = ICollision.Bottom;
            }
            else if (blockType == 2)
            {
                sprite = BlockSpriteFactory.Instance.CreateBlock(10, this);
                destination = new Vector2(336, 240);
                MoveDirection = -Vector2.UnitY;
                side = ICollision.Top;
            }
        }

        public Rectangle getPos()
        {
            return posRectangle;

        }

        public void DrawBlock()
        {
            sprite.draw();

        }

        public void UpdateBlock()
        {

        }


        public void Collide()
        {

        }

        public bool IsRemoved()
        {
            return removed;
        }

        public bool isMovable()
        {
            return false;
        }

        public bool isExit()
        {
            return true;
        }

    }
}