public void UpgradeMagSize(float percentage) { //busca en todas las armas foreach (Transform child in transform) { Gun gun = child.GetComponentInChildren <Gun>(); if (gun) { //aumenta la municion gun.magSize += Mathf.RoundToInt(gun.magSize * (percentage / 100)); gun.UpdateAmmo(); //Actualiza la munición del arma equipada if (gun.gameObject.activeInHierarchy) { GameManager.instance.UpdateMaxAmmo(gun.magSize); GameManager.instance.UpdateAmmo(gun.BulletsLeft()); } else if (gun.iAmWeapon == equipadas[(currentWeapon + 1) % equipadas.Length]) { GameManager.instance.UpdateSecondaryAmmo(gun.BulletsLeft(), gun.magSize); } //Actualiza la munición del arma no equipada else if (gun.iAmWeapon == equipadas[(currentWeapon + 1) % equipadas.Length]) { GameManager.instance.UpdateSecondaryAmmo(gun.BulletsLeft(), gun.magSize); } } } }