示例#1
0
 public void respawn()
 {
     Health = 100;
     inventory.clearInventory();
     rightHand = 0;
     leftHand  = 0;
     LeftReloadTimer.Restart();
     RightReloadTimer.Restart();
     rightHand = 1;
     //start kit
     inventory.addItem(1);
     inventory.addItem(7, 10);
     inventory.setCurrentArrow(7);
 }
示例#2
0
        public int attack()
        {
            int total = 0;

            if (LeftReloadTimer.ElapsedMilliseconds >= ((Weapon)Items.allItems[leftHand]).Reloading)
            {
                LeftReloadTimer.Restart();
                if (inventory.getItem(leftHand).GetType() == typeof(ItemBow))
                {
                    total = total + ((ItemBow)inventory.getItem(leftHand)).attack(inventory);
                }
                else if (inventory.getItem(leftHand).GetType() == typeof(Magic))
                {
                    total = total + ((Magic)inventory.getItem(leftHand)).attack(inventory);
                }
                else if (inventory.getItem(leftHand).GetType() == typeof(ItemSword))
                {
                    total = total + ((ItemSword)inventory.getItem(leftHand)).attack();
                }
            }
            if (RightReloadTimer.ElapsedMilliseconds >= ((Weapon)Items.allItems[rightHand]).Reloading)
            {
                RightReloadTimer.Restart();
                if (inventory.getItem(rightHand).GetType() == typeof(ItemBow))
                {
                    total = total + ((ItemBow)inventory.getItem(rightHand)).attack(inventory);
                }
                else if (inventory.getItem(rightHand).GetType() == typeof(Magic))
                {
                    total = total + ((Magic)inventory.getItem(rightHand)).attack(inventory);
                }
                else if (inventory.getItem(leftHand).GetType() == typeof(ItemSword))
                {
                    total = total + ((ItemSword)inventory.getItem(rightHand)).attack();
                }
            }
            return(total);
        }