Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        logo.Rotate(Vector3.forward * 20 * Time.deltaTime);

        rupeeAmount.text = Diamond.GetCurrentDiamondAmount().ToString();

        // For debug only
        if (Input.GetKeyDown(KeyCode.B))
        {
            PlayerPrefs.SetInt(Diamond.DiamondType, PlayerPrefs.GetInt(Diamond.DiamondType) + 500);
        }
        if (Input.GetKeyDown(KeyCode.U))
        {
            PlayerUpgrades.ResetPlayerUpgrades();
        }
        if (Input.GetKeyDown(KeyCode.R))
        {
            Diamond.ResetDiamondAmount();
        }

        UpdateUpgradeButtonStates(PlayerUpgrades.MaxHealth, playerData.maxHealth, maxHealthUpgradeButton);
        UpdateUpgradeButtonStates(PlayerUpgrades.HealthRegen, playerData.healthRegen, regenRateUpgradeButton);
        UpdateUpgradeButtonStates(PlayerUpgrades.RegenCooldown, playerData.regenCooldown, regenCooldownUpgradeButton);
        UpdateUpgradeButtonStates(PlayerUpgrades.Speed, playerData.speed, speedUpgradeButton);
        UpdateUpgradeButtonStates(PlayerUpgrades.AimDistance, playerData.aimDistance, aimDistanceUpgradeButton);
    }
Exemplo n.º 2
0
    private bool CanUpgrade(string upgrade, Upgrade upgradeData)
    {
        int currentUpgradeLevel = PlayerUpgrades.GetUpgradeLevel(upgrade);

        if (currentUpgradeLevel == upgradeData.levelUpgradeCosts.Length)
        {
            return(false);
        }
        int upgradeCost = upgradeData.levelUpgradeCosts[currentUpgradeLevel];

        return(Diamond.GetCurrentDiamondAmount() >= upgradeCost);
    }