private void Awake()
{
currentHealth = startingHealth;
movement = GetComponent();
points = PlayerPrefs.GetInt("Points", 0);
currentHealth = PlayerPrefs.GetInt("Health", startingHealth);
movement.extraJumpValue = PlayerPrefs.GetInt("JumpThree", movement.extraJumpValue);
movement.jumpForce = PlayerPrefs.GetFloat("JumpHeight", movement.jumpForce);
movement.speed = PlayerPrefs.GetFloat("PlayerSpeed", movement.speed);
}
public void ResetStats()
{
PlayerPrefs.SetInt("Points", points);
PlayerPrefs.SetInt("Health", 100);
PlayerPrefs.SetInt("JumpThree", 1);
PlayerPrefs.SetFloat("JumpHeight", 5);
PlayerPrefs.SetFloat("PlayerSpeed", 3);
}
private void OnDestroy()
{
PlayerPrefs.SetInt("Points", points);
PlayerPrefs.SetInt("Health", currentHealth);
PlayerPrefs.SetInt("JumpThree", movement.extraJumpValue);
PlayerPrefs.SetFloat("JumpHeight", movement.jumpForce);
PlayerPrefs.SetFloat("PlayerSpeed", movement.speed);
}
↧