public void PlayerInteraction()
 {
     if (intDetector != null)
     {
         Interaction interaction = intDetector.GetClosestInteraction();
         if (interaction is WeaponItem && inventory != null)
         {
             WeaponItemData weaponItemData = ((WeaponItem)interaction).GetWeaponItemData();
             inventory.AddWeapon(weaponItemData);
             Destroy(interaction.gameObject);
             //If this is the only weapon in inventory, and no weapon is equiped, equip it
             if (inventory.GetArsenalSize() == 1 && equippedWeapon == null)
             {
                 InstantiateWeapon(weaponItemData.GetPrefabPath());
             }
             Debug.Log(interaction.gameObject.name);
         }
         else if (interaction is Door)
         {
             Door door = (Door)interaction;
             if (door.IsInteractive())
             {
                 door.Open();
             }
         }
     }
     else
     {
         Debug.Log("Interaction detector not found on " + gameObject.name);
     }
 }
    public IEnumerator ChangeWeapon(int input)
    {
        WeaponItemData weaponItemData = null;

        //check if changing weapon is possible (more than 1 weapon in inventory)
        if (HasInventory() && input != 0 && inventory.GetArsenalSize() > 1 && CanChangeWeapon())
        {
            ChangeWeaponAxisInUse = true;
            Debug.Log(input);
            if (input < 0)
            {
                weaponItemData = inventory.SelectNextWeapon();
            }
            else if (input > 0)
            {
                weaponItemData = inventory.SelectPreviousWeapon();
            }
            if (weaponItemData != null)
            {
                InstantiateWeapon(weaponItemData.GetPrefabPath());
                yield return(weaponSwapDelaySeconds);
            }
        }
        ChangeWeaponAxisInUse = false;
    }
    public IEnumerator EquipLatestWeapon()
    {
        WeaponItemData weaponItemData = null;

        //check if changing weapon is possible (more than 1 weapon in inventory)
        if (HasInventory() && inventory.GetArsenalSize() > 1 && CanChangeWeapon())
        {
            weaponItemData        = inventory.SelectLatestWeapon();
            ChangeWeaponAxisInUse = true;
            if (weaponItemData != null && weaponItemData.GetPrefabPath() != weapon.GetPrefab())
            {
                InstantiateWeapon(weaponItemData.GetPrefabPath());
                yield return(weaponSwapDelaySeconds);
            }
        }
        ChangeWeaponAxisInUse = false;
    }
    public IEnumerator EquipWeaponSlot(int slot)
    {
        WeaponItemData weaponItemData = null;

        if (HasInventory() && CanChangeWeapon())
        {
            weaponItemData        = inventory.SelectWeaponSlot(slot);
            ChangeWeaponAxisInUse = true;
            if (weaponItemData != null)
            {
                InstantiateWeapon(weaponItemData.GetPrefabPath());
                yield return(weaponSwapDelaySeconds);
            }
        }
        ChangeWeaponAxisInUse = false;
    }