public override void DropItem(Level level, int i)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Z) && pastKey6.IsKeyUp(Keys.Z))
            {
                if (SelectedItem != -1)
                {
                    if (SelectedItem == 0)
                    {
                        if (Inventory.Count == 1)
                        {
                            SelectedItem = -1;
                        }
                    }
                    else
                    {
                        SelectedItem--;
                    }
                    Global.SoundManager.dropFromInventory.Play();
                    Global.Gui.WriteToConsole("You dropped " + Inventory.ElementAt(i).Name);

                    if (Inventory.ElementAt(i).Category.Contains("PositionTargetedAttackItem"))
                    {
                        ItemProjectileAttack = null;
                    }

                    base.DropItem(level, i);
                }
                else
                {
                    Global.Gui.WriteToConsole("You dont have any items to drop");
                }
            }
            pastKey6 = Keyboard.GetState();
        }
Beispiel #2
0
 public Trap(IPositionTargetedAttack attack, Character attacker, Vector2 position, Texture2D texture) : base(position, texture)
 {
     Attack         = attack;
     Attacker       = attacker;
     Position       = position;
     IsCharacterHit = false;
 }
 public LichProjectile(IPositionTargetedAttack attack, Character attacker, Vector2 velocity, Vector2 position, Texture2D texture, float rotation, int range, float vanishDelay, Vector2 center) : base(attack, attacker, velocity, position, texture, rotation, range, vanishDelay)
 {
     centerOfRotation        = center + new Vector2(320, 320);
     wasHitByThisProjectille = new List <Character>();
     do
     {
         randomFactor = (float)Global.random.NextDouble() + 0.7f;
     } while (randomFactor > 1.3f);
 }
 public Projectile(IPositionTargetedAttack attack, Character attacker, Vector2 velocity, Vector2 position, Texture2D texture, float rotation, int range, float vanishDelay) : base(position, texture)
 {
     Attack           = attack;
     Attacker         = attacker;
     OriginalPosition = position;
     Velocity         = velocity;
     Rotation         = rotation;
     Range            = range;
     IsCharacterHit   = false;
     VanishDelay      = vanishDelay;
 }
        public override bool TakeItem(Level level, GraphicsDevice graphicsDevice)
        {
            bool IsItemTaken = false;

            if (Keyboard.GetState().IsKeyDown(Keys.F) && pastKey5.IsKeyUp(Keys.F))
            {
                if (Inventory.Count < inventoryPickUpLimit)
                {
                    if (base.TakeItem(level, graphicsDevice))
                    {
                        Global.SoundManager.takeToInventory.Play();
                        Item Item = Inventory.ElementAt(Inventory.Count - 1);
                        Global.Gui.WriteToConsole("You picked up " + Item.Name);

                        if (Item.Category.Contains("PositionTargetedAttackItem"))
                        {
                            String AttackClassName = Item.Category.Split('_')[1];
                            ItemProjectileAttack = (IPositionTargetedAttack)Activator.CreateInstance(Type.GetType("Dungeon_Crawler." + AttackClassName));
                        }

                        IsItemTaken = true;
                        if (SelectedItem == -1)
                        {
                            SelectedItem = 0;
                        }
                    }
                    else
                    {
                        Global.Gui.WriteToConsole("You cant pick up more items of that kind");
                    }
                }
                else
                {
                    Global.Gui.WriteToConsole("You cant pick up more items");
                }
            }
            pastKey5 = Keyboard.GetState();
            return(IsItemTaken);
        }
 public RotatingPiercingProjectille(IPositionTargetedAttack attack, Character attacker, Vector2 velocity, Vector2 position, Texture2D texture, float rotation, int range, float vanishDelay) : base(attack, attacker, velocity, position, texture, rotation, range, vanishDelay)
 {
 }
 public PiercingProjectile(IPositionTargetedAttack attack, Character attacker, Vector2 velocity, Vector2 position, Texture2D texture, float rotation, int range, float vanishDelay) : base(attack, attacker, velocity, position, texture, rotation, range, vanishDelay)
 {
     wasHitByThisProjectille = new List <Character>();
 }