//Allows the player to purchase the upgrade on the Upgrade Menu public void GetUpgrade(GameObject UpgradeDisplayObject) { UpgradeDisplay UD = UpgradeDisplayObject.GetComponent <UpgradeDisplay>(); upgradeType = GetUpgradeType(upgrade.upgradeType); if (upgradeType == (int)UpgradeType.Player) { ++currentLevel; Debug.Log("Player stat changed"); if (upgrade.Name == "Deadeye") { UpdateGunStats(); } else { UpdatePlayerStats(); } //TO DO: ADD FUNCTIONS THAT WILL TAKE PLAYER'S ORES FROM THEIR INVENTORY AND ADJUST THEIR AFFECTED STATS Debug.Log("Upgrade Cost: " + upgradeCost); UD.inventory.SpendOres(upgradeCost); } else if (upgradeType == (int)UpgradeType.Gun) { ++currentLevel; Debug.Log("Gun stat changed"); UpdateGunStats(); //TO DO: ADD FUNCTIONS THAT WILL TAKE PLAYER'S CRYSTALS FROM THEIR INVENTORY AND ADJUST THEIR AFFECTED STATS Debug.Log("Upgrade Cost: " + upgradeCost); UD.inventory.SpendCrystals(upgradeCost); } else { Debug.Log("Invalid Upgrade Type..."); } }
//Checks to see if the player can afford to purchase the next upgrade public bool CheckInventory(GameObject UpgradeDisplayObject) { UpgradeDisplay UD = UpgradeDisplayObject.GetComponent <UpgradeDisplay>(); /*crystalCount = UD.inventory.GetCrystalCount(); * oreCount = UD.inventory.GetOreCount();*/ if (UD.oreCount) { oreCount = UD.inventory.GetOreCount(); UD.oreCount.text = oreCount.ToString(); } if (UD.crystalCount) { crystalCount = UD.inventory.GetCrystalCount(); UD.crystalCount.text = crystalCount.ToString(); } //TO DO: CHANGE "upgrade.statList[currentLevel]" TO PLAYER'S RESPECTIVE CURRENCY FOR UPGRADE (MAYBE A FUNCTION?) if (GetResourceAmount() >= upgrade.statCost[currentLevel + 1]) { return(true); } else { return(false); } }
public void Init(Specialization spec, SimulationManager simulation, ParallelTimelineDisplay timelines) { Name.text = spec.Name; foreach (Upgrade upgrade in spec.Upgrades) { UpgradeDisplay upgradeDisplay = Instantiate(UpgradeDisplayPrefab, UpgradeDisplayParent, false); upgradeDisplay.Upgrade = upgrade; upgradeDisplay.Simulation = simulation; upgradeDisplay.Timelines = timelines; } }
void Awake() { if (upgradeDisp == null) { upgradeDisp = this; } else if (upgradeDisp != this) { Debug.Log("You had two upgrade displays."); Destroy(gameObject); } }
/// <summary> /// /// Function handler for click events /// /// </summary> public void OnPointerClick(PointerEventData eventData) { //Right clicking on a card always shows the detail display if (eventData.button == PointerEventData.InputButton.Right) { if (CardDisplay == null) { UpgradeDisplay.DisplayUpgradeDetail(); } else if (UpgradeDisplay == null) { CardDisplay.DisplayCardDetail(); } } //Left click selects the card in hand. Can't click cards if UI locked if (eventData.button == PointerEventData.InputButton.Left && !isHidden) { switch (GameManager.instance.effectManager.ActiveEffect) { case EffectManager.ActiveEffectTypes.EnchantUnit: if (Card.Type == CardTypes.Unit) { GameManager.instance.effectManager.EnchantUnit((Unit)Card); CardDisplay.UpdateProperties(); } break; case EffectManager.ActiveEffectTypes.ModifyCost: GameManager.instance.effectManager.ModifyCost(Card); break; default: if (!GameManager.instance.effectManager.IsUILocked) { SelectDisplay(); } break; } } }
//Sets the values on the Upgrade Menu based on the variables of the Upgrade Scriptable Object being used public void SetValues(GameObject UpgradeDisplayObject) { //if (UpgradeDisplayObject) //{ UpgradeDisplay UD = UpgradeDisplayObject.GetComponent <UpgradeDisplay>(); UD.upgradeName.text = upgrade.Name + ":"; if (UD.upgradeLevels) { UD.upgradeLevels.text = currentLevel + "/" + (upgrade.statList.Count - 1); } if (UD.currentUpgradeStat) { UD.currentUpgradeStat.text = upgrade.statList[currentLevel].ToString(); } if (UD.nextUpgradeStat) { if (currentLevel < (upgrade.statList.Count - 1)) { UD.nextUpgradeStat.text = upgrade.statList[currentLevel + 1].ToString(); reachedMax = false; } else { UD.nextUpgradeStat.text = "Max Reached"; reachedMax = true; } } if (UD.upgradeCost) { if (reachedMax) { UD.upgradeCost.text = "N/A"; } else { UD.upgradeCost.text = upgrade.statCost[currentLevel + 1].ToString(); upgradeCost = upgrade.statCost[currentLevel + 1]; } } if (UD.currentUpgradeBG) { UD.currentUpgradeBG.sprite = UD.upgradeBackgrounds[currentLevel]; } /*if (UD.oreCount) * { * oreCount = UD.inventory.GetOreCount(); * UD.oreCount.text = oreCount.ToString(); * } * * if (UD.crystalCount) * { * crystalCount = UD.inventory.GetCrystalCount(); * UD.crystalCount.text = crystalCount.ToString(); * }*/ UD.ToggleBuyButton(); SaveLoad.Save(currentLevel, upgrade.Name); //} }