public void Increment() { if (_upgradeable == null) { return; } _upgradeable.Upgrade(); RefreshShownValues(); }
/// /// Upgrade the ship and the specified upgradeble. /// public void Upgrade(IUpgradeable upgradeable) { // full health recovery this.health = this.maxHealth; if (upgradeable.CanUpgrade()) { upgradeable.Upgrade(); } Game.Instance.ShowMessage(UItext.MessageType.RankUp, Game.Instance.ExplorationCount.ToString()); }
void TryToUpgrade(IUpgradeable upgradeable) { // If we have enough money if (upgradeable.CanUpgrade() && PlayerData.Instance.CanAfford(upgradeable.GetUpgradeCost())) { //Spend the money PlayerData.Instance.Spend(upgradeable.GetUpgradeCost()); //Upgrade upgradeable.Upgrade(); var cost = upgradeable.GetUpgradeCost(); var text = cost >= 0 ? cost.ToString() : "-"; UpgradeButton.transform.GetChild(0).Find("Price").GetComponent <TMPro.TextMeshProUGUI>().text = text; } }
/// <summary> /// Called from Controller, if target available proceed. /// </summary> internal void PickUp() { if (m_target == null || m_upgradeableTarget == null) { return; } if (Upgrade) { m_upgradeableTarget?.Upgrade(); } else { m_target?.PickUp(m_weapon); } m_target = null; m_upgradeableTarget = null; m_photonView.RPC("ChangeStateRPC", RpcTarget.All, false); PickedWeapon?.Invoke(); }
public void UpgradeInstance(IUpgradeable instance) { instance.Upgrade(upgradeType, Level, maxLevel); }