Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SaveManager : MonoBehaviour {
- public static SaveManager saveManager { get; set; }
- [SerializeField]
- int areaNumber;
- [SerializeField]
- float currentPlayerBloodlust;
- private float playerBloodlust;
- private void Awake()
- {
- if (saveManager == null)
- {
- saveManager = this;
- DontDestroyOnLoad(gameObject);
- }
- else
- {
- Destroy(gameObject);
- }
- }
- // Update is called once per frame
- void Update () {
- playerBloodlust = FindObjectOfType<Player>().Sanity;
- }
- void SaveGameData()
- {
- PlayerPrefs.SetInt("Area", areaNumber);
- PlayerPrefs.SetFloat("Bloodlust", currentPlayerBloodlust);
- }
- void LoadGameData()
- {
- areaNumber = PlayerPrefs.GetInt("Area");
- currentPlayerBloodlust = PlayerPrefs.GetInt("Bloodlust");
- }
- void ResetData()
- {
- areaNumber = 1;
- currentPlayerBloodlust = 100;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement