Game-Design / Sprint3_actual / Items / BombItem.cs
BombItem.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.ActiveItems;
using Sprint3_actual.StateFiles;

namespace Sprint3_actual
{
    class BombItem : IStageItem
    {

        private ISprite BombSprite;
        private Rectangle posRectangle;
        private bool removed;

        public bool hasActiveItem => true;
        public bool isStoreableItem => true;

        public BombItem(int xPos, int yPos)
        {
            this.removed = false;
            this.posRectangle = new Rectangle(xPos, yPos, 16, 32);
            this.BombSprite = ItemSpriteFactory.Instance.CreateBombItem(this);

        }

        public void setPos(int destx, int desty)
        {
            posRectangle = new Rectangle(destx, desty, 16, 32);
            BombSprite = ItemSpriteFactory.Instance.CreateBombItem(this);
        }
        public Rectangle getPos()
        {
            return posRectangle;

        }

        public void DrawItem()
        {
            BombSprite.draw();

        }

        public void UpdateItem(GameTime gameTime)
        {
            //BombSprite.update(gameTime);

        }

        public void Collide()
        {
            removed = true;
            Inventory.Instance.BombCount += 4;
        }

        public bool IsRemoved()
        {
            return removed;
        }

        public IActiveItem ReturnItem(ILink link, Game1 game)
        {
            return new Bomb(link, game);
        }
    }
}