using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Sprint3_actual.StateFiles; using System; using System.Collections.Generic; using System.Text; using Sprint3_actual.SoundManagement; namespace Sprint3_actual.ActiveItems { public class Dungeon2Fireball : IActiveItem { private Texture2D texture; public int ItemX; public int ItemY; private Rectangle itemRectangle; private Vector2 Velocity; private bool Removed; private AItemSprites ItemSprites; private const double speedmultiplier = 0.3; private room Room; public Dungeon2Fireball(Texture2D Texture, int X, int Y, Vector2 direction, room Room) { ItemX = X; ItemY = Y; texture = Texture; Velocity = direction; itemRectangle = new Rectangle(ItemX, ItemY, 16, 20); ItemSprites = new Dungeon2FireballSprite(this, texture); this.Room = Room; } public void ActiveItemDown() { throw new NotImplementedException(); } public void ActiveItemLeft() { Room.EnemyItems.Add(this); } public void ActiveItemRight() { throw new NotImplementedException(); } public void ActiveItemUp() { throw new NotImplementedException(); } public float Collide() { Remove(); return 1.0f; } public void Draw() { if (!Removed) ItemSprites.draw(); } public bool IsRemoved() { return Removed; } public Rectangle PositionRectangle() { return itemRectangle; } public void Remove() { Removed = true; } public void Update() { if (!Removed) { itemRectangle.X += (int)(Velocity.X * GlobalVars.gameTime.ElapsedGameTime.TotalMilliseconds * speedmultiplier); itemRectangle.Y += (int)(Velocity.Y * GlobalVars.gameTime.ElapsedGameTime.TotalMilliseconds * speedmultiplier); } ItemSprites.update(GlobalVars.gameTime); } public void ItemSound() { SoundEngine.Instance.playFlameShot(); } } }