private void FixedUpdate()
 {
     if (changingWeapon != 0 && equipedWeapons.Count > 1)
     {
         indexWeapon += changingWeapon;
         if (indexWeapon < 0)
         {
             indexWeapon = equipedWeapons.Count - 1;
         }
         actualWeapon.SetActive(false);
         indexWeapon  = (indexWeapon % equipedWeapons.Count);
         actualWeapon = equipedWeapons[indexWeapon];
         actualWeapon.SetActive(true);
         AbstractWeapon weaponScript = actualWeapon.GetComponent <AbstractWeapon>();
         weaponScript.EquipAudio();
         StartCoroutine(EquipWeaponUI(weaponScript));
         ConfigReloadBar(weaponScript);
     }
 }
    /// <summary>
    ///  Add the weapon to the inventory as active weapon, can be a prefab, or instantiated weapon
    /// </summary>
    /// <param name="pickerWeapon"> The weapon to add, can be a PREFAB (so we need create a instance) or a real weapon</param>
    /// <param name="isPrefab">if is true, we need instantiate the new weapon, if not, just attach</param>
    public void EquipWeapon(GameObject pickerWeapon, bool isPrefab)
    {
        if (objectSpawner)
        {
            GameObject newWeapon = null;
            if (isPrefab)
            {
                newWeapon = Instantiate(pickerWeapon, objectSpawner);
            }
            else
            {
                newWeapon = pickerWeapon;
                //pos in the right pos/rot
                newWeapon.transform.SetParent(objectSpawner);
                newWeapon.transform.localPosition = Vector3.zero;
                newWeapon.transform.localRotation = Quaternion.Euler(Vector3.zero);
            }
            AbstractWeapon weaponScript = newWeapon.GetComponent <AbstractWeapon>();
            weaponScript.active = true;
            weaponScript.EquipAudio();
            //set the icon
            if (equipedWeapons.Count < maxWeapons)
            {
                //can pick a weapon keeping the previous!
                // so add to the list, and move the actualWeapon to the new;
                if (actualWeapon != null)
                {
                    actualWeapon.SetActive(false);
                }
                equipedWeapons.Add(newWeapon);
                indexWeapon  = equipedWeapons.Count - 1;
                actualWeapon = equipedWeapons[indexWeapon];
            }
            else
            {
                // the bag is full of weapons... so we must replace the actual

                // GEnerate a new pickable droping the actual weapon,
                //drop the actual weapon
                AbstractWeapon wToDrop = actualWeapon.GetComponent <AbstractWeapon>();
                wToDrop.active = false; // just to not shoot the droped weapon
                if (wToDrop.haveLaserSight)
                {
                    Transform laserSight = actualWeapon.transform.Find("laserSight(Clone)");
                    if (laserSight)
                    {
                        laserSight.gameObject.SetActive(false);
                    }
                }
                WeaponSpawnManager.instance.InstantiateWeapon(objectSpawner, false, wToDrop.weaponType, actualWeapon);

                equipedWeapons[indexWeapon] = newWeapon;
                actualWeapon = newWeapon;
            }
            actualWeapon.SetActive(true);
            AbstractWeapon weapon = actualWeapon.GetComponent <AbstractWeapon>();
            ConfigReloadBar(weapon);

            //we must wait to the instance of UI is created, to this is in a coroutine
            StartCoroutine(EquipWeaponUI(weapon));
        }
    }