Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- public class MainMenu : MonoBehaviour
- {
- public string startLevel;// Updated to use SceneManager
- public string levelSelect; // Updated to use SceneManager
- public int playerHealth;// Set the player's health to the playerHealth variable
- public int playerLives;
- public void NewGame()
- {
- // Application.LoadLevel(startLevel);
- SceneManager.LoadScene(startLevel);
- PlayerPrefs.SetInt("PlayerCurrentLives", playerLives);
- PlayerPrefs.SetInt("PlayerCurrentScore", 0);
- PlayerPrefs.SetInt("PlayerCurrentHealth", playerHealth); // Set the player's health to the playerHealth variable
- PlayerPrefs.SetInt("PlayerMaxHealth", playerHealth);// Set the player's health to the playerHealth variable
- }
- public void LevelSelect()
- {
- PlayerPrefs.SetInt("PlayerCurrentLives", playerLives);// Set the player's lives in the PlayerPrefs
- PlayerPrefs.SetInt("PlayerCurrentScore", 0);// Set the player's score in the PlayerPrefs
- PlayerPrefs.SetInt("PlayerCurrentHealth", playerHealth); // Set the player's health to the playerHealth variable
- PlayerPrefs.SetInt("PlayerMaxHealth", playerHealth);// Set the player's health to the playerHealth variable
- // Application.LoadLevel(levelSelect);
- SceneManager.LoadScene(levelSelect);
- }
- public void QuitGame()
- {
- Application.Quit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement