fix upgrades

This commit is contained in:
myondev 2026-03-03 09:16:19 -08:00
parent d8c49317a3
commit 5dcbd3c313
17 changed files with 477 additions and 83 deletions

View file

@ -5,21 +5,20 @@ public class AbilityUpgrade : ScriptableObject
[Header("Identification")]
public string upgradeName;
public Sprite upgradeIcon;
public PlayerAbility thisPlayerAbility;
[Header("Stats")]
public int count = 1;
public PlayerAbility thisPlayerAbility;
public virtual void ApplyUpgrade()
public void ApplyUpgrade(PlayerAbility abilityToUpgrade)
{
UpgradeEffects();
UpgradeEffects(abilityToUpgrade);
}
protected virtual void UpgradeEffects()
protected virtual void UpgradeEffects(PlayerAbility abilityToUpgrade)
{
}
public virtual void ApplyRemoval()
public virtual void ApplyRemoval(PlayerAbility abilityToRemove)
{
}

View file

@ -4,9 +4,8 @@ public class AttackSpeedUpgrade : AbilityUpgrade
{
[SerializeField] private float speedUpgradeAmount;
public override void ApplyUpgrade()
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
{
base.ApplyUpgrade();
thisPlayerAbility.cooldown *= speedUpgradeAmount;
}
}

View file

@ -3,8 +3,8 @@ using UnityEngine;
[CreateAssetMenu(fileName = "Projectile Count Upgrade", menuName = "AbilityUpgrades/ProjectileCountUpgrade")]
public class ProjectileCountUpgrade : AbilityUpgrade
{
protected override void UpgradeEffects()
protected override void UpgradeEffects(PlayerAbility abilityToUpgrade)
{
thisPlayerAbility.projectileCount++; //idk how this will work for the stacking.
abilityToUpgrade.projectileCount++; //idk how this will work for the stacking.
}
}

View file

@ -17,12 +17,11 @@ public class UpgradeBoxUI : MonoBehaviour, IDropHandler
return;
}
counterUI.gameObject.SetActive(true);
counterUI.text = $"x{thisAbilityUpgrade.count}";
counterUI.text = $"x{thisPlayerAbility.attachedUpgrades[thisAbilityUpgrade]}";
}
public void OnDrop(PointerEventData eventData)
{
Debug.Log("A");
if (eventData.pointerDrag.TryGetComponent(out StoredAbilityUpgradeUI isStoredUpgrade) && (!thisAbilityUpgrade || isStoredUpgrade.storedUpgrade == thisAbilityUpgrade))
{
thisAbilityUpgrade = isStoredUpgrade.storedUpgrade;