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

namespace Sprint3_actual
{
    class AmbrosiaItem : IStageItem
    {
        private Game1 game;
        private ISprite AmbrosiaSprite;
        private Rectangle posRectangle;
        private bool removed;

        bool IStageItem.hasActiveItem => true;
        public bool isStoreableItem => false;

        public AmbrosiaItem(int xPos, int yPos, Game1 game)
        {
            this.removed = false;
            this.game = game;
            this.posRectangle = new Rectangle(xPos, yPos, 8*3, 16*3);
            this.AmbrosiaSprite = ItemSpriteFactory.Instance.CreateAmbrosiaItem(this);

        }

        public void setPos(int destx, int desty)
        {
            posRectangle.X = destx;
            posRectangle.Y = desty;
        }
        public Rectangle getPos()
        {
            return posRectangle;

        }

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

        }

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

        }

        public void Collide()
        {
            removed = true;
            SoundEngine.Instance.playVineBoom();
            game.Player.SetSpeed(400);

        }

        public bool IsRemoved()
        {
            return removed;
        }

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