Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class Menu : MonoBehaviour
- {
- public void StartGame()
- {
- SceneManager.LoadScene(0); //указываем номер сцены для загрузки
- }
- public void Back()
- {
- SceneManager.LoadScene(0);
- }
- public void Credits()
- {
- SceneManager.LoadScene(2);
- }
- [SerializeField] GameObject player;
- public void Save()
- {
- Vector3 vector = player.transform.position;
- int health = player.GetComponent<PlayerController>().GetHealth();
- PlayerPrefs.SetFloat("playerX", vector.x);
- PlayerPrefs.SetFloat("playerY", vector.y);
- PlayerPrefs.SetFloat("playerZ", vector.z);
- PlayerPrefs.SetInt("health", health);
- PlayerPrefs.Save();
- }
- public void Reset()
- {
- PlayerPrefs.SetFloat("playerX", 596.9f);
- PlayerPrefs.SetFloat("playerY", 0.4f);
- PlayerPrefs.SetFloat("playerZ", 733.7f);
- PlayerPrefs.SetInt("health", 100);
- PlayerPrefs.Save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement