58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ShopManager : MonoBehaviour
|
|
{
|
|
#region Statication
|
|
|
|
public static ShopManager instance;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance != null && instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
instance = this;
|
|
DontDestroyOnLoad(this);
|
|
}
|
|
|
|
#endregion
|
|
public List<AbilityUpgrade> buyableUpgrades;
|
|
public int currency; //uh. we need to figure out this one lol
|
|
public GameObject shopUIObject;
|
|
[SerializeField] private Marisa player;
|
|
public void GenerateUpgradeList()
|
|
{
|
|
|
|
}
|
|
|
|
public void BuyUpgrade(AbilityUpgrade abilityToBuy)
|
|
{
|
|
if (currency >= abilityToBuy.cost)
|
|
{
|
|
AbilityManager.instance.upgradesInventory[abilityToBuy]++;
|
|
currency -= abilityToBuy.cost;
|
|
}
|
|
|
|
}
|
|
|
|
public void SellUpgrade(AbilityUpgrade abilityToSell)
|
|
{
|
|
AbilityManager.instance.upgradesInventory[abilityToSell]--;
|
|
currency += abilityToSell.cost/2;
|
|
}
|
|
|
|
public void OpenShopUI()
|
|
{
|
|
shopUIObject.SetActive(true);
|
|
player.stalled = true;
|
|
}
|
|
|
|
public void CloseShopUI()
|
|
{
|
|
shopUIObject.SetActive(false);
|
|
player.stalled = false;
|
|
}
|
|
}
|