public void OnUpgradeButtonPressed(string weaponName, UpgradeRow row) { RangedWeapon weapon = WeaponManager.Instance.GetWeapon(weaponName); if (Player.Instance.Coins >= weapon.stats.currentUpgradeCost && weapon != null) { weapon.Upgrade(); row.SetText(weapon.stats.name, weapon.stats.currentUpgradeCost, weapon.stats.upgradeLevel); } else if (weapon == null) { Debug.LogWarning("Weapon: " + name + " can not be found"); } else { Sequence sequence = DOTween.Sequence() .Append(notEnoughCoinsText.DOFade(1, 0.5f)) .AppendInterval(1f) .Append(notEnoughCoinsText.DOFade(0, 0.5f)); } if (weapon.stats.upgradeLevel == MaxUpgradeLevel) { row.OnUpgradeLimitReached(); } }