private void Update() { StaminaSlider.value = GetCurrentStamina(); ManaSlider.value = GetCurrentMana(); healthslider.value = GetCurrentHealth(); if (PlayersHealth <= 0) { Time.timeScale = 1f; FindObjectOfType <GameOver>().gameoverScreen.SetActive(true); if (isdead == true) { Instantiate(playerDeathFx, transform.position, Quaternion.identity); Destroy(gameObject); } } if (PlayersHealth >= MaxHealth) { PlayersHealth = MaxHealth; FindObjectOfType <GameOver>().gameoverScreen.SetActive(false); } if (PlayersMana >= MaxMana) { PlayersMana = MaxMana; } CurrenTime += 1 * Time.deltaTime; if (CurrenTime >= 800) { SaveMangerSystem.SavePlayerData(this); //AutosaveText.gameObject.SetActive(true); Debug.Log("autoSaved"); CurrenTime = 0; } //else //{ // AutosaveText.gameObject.SetActive(false); //} if (PlayersMana < MaxMana) { { PlayersMana += 5 * Time.deltaTime; } } if (PlayersStamina < MaxStamina) { { PlayersStamina += 4 * Time.deltaTime; } } }
public void SavePlayer() { SaveMangerSystem.SavePlayerData(this); }