Exemplo n.º 1
0
    public void LoadData()
    {
        //load data
        startLocation = JsonDataManager.gameData.playerStartLocation;
        playerHealthComp.CurrentHealth  = JsonDataManager.gameData.playerHealth;
        defaultMovementSpeed            = JsonDataManager.gameData.defaultMovementSpeed;
        playerHealthComp.maxHealth      = JsonDataManager.gameData.playerMaxHealth;
        _playerEnergy.playerMaxEnergy   = JsonDataManager.gameData.playerMaxEnergy;
        playerHealthComp.canHealthRegen = JsonDataManager.gameData.canHealthRegen;
        DamageMultiplier = JsonDataManager.gameData.damageMultiplier;

        currentMovementSpeed        = defaultMovementSpeed;
        _playerEnergy.currentEnergy = _playerEnergy.playerMaxEnergy;
        _playerEnergy.EnergyAmountCalc();
        playerHealthComp.CurrentHealth = playerHealthComp.maxHealth;
        playerHealthComp.HealthRegenCalc();
        transform.position = startLocation;

        _uiManager.UpdateHealthSlider();
        _uiManager.UpdateEnergySlider();

        if (playerHealthComp.canHealthRegen)
        {
            _uiManager.healthRegenStatus.text = _uiManager.regenStatusOn;
        }
        else
        {
            _uiManager.healthRegenStatus.text = _uiManager.regenStatusOff;
        }
        Debug.Log("Player position loaded");
    }