Beispiel #1
0
 private void UseItem(float x, float y, bool saveLastDirection)
 {
     if (Inventory.instance.IsItemInHotBar())
     {
         string selecteditemType = Inventory.instance.GetTypeOfSelectedItem();
         if (selecteditemType == "MeleeWeapon")
         {
             playerCombat.MeleeAttack(x, y, saveLastDirection);
         }
         else if (selecteditemType == "ShootWapon")
         {
             playerCombat.Shoot(x, y, saveLastDirection);
         }
         else if (selecteditemType == "Potion")
         {
             playerProperties.Heal(Inventory.instance.GetSelectedItem().HP);
             Inventory.instance.DestroyCurrentItem(Inventory.instance.SelectedItemIndex);
         }
         else if (selecteditemType == "Bomb")
         {
             playerCombat.CastBomb();
         }
     }
 }