Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if ((image.GetScreenRect().Contains(Input.mousePosition) && Input.GetMouseButtonDown(0)) || Input.GetKey(KeyCode.P))
        {
            if (scenename == "Exit")
            {
                PlayerPrefs.DeleteAll();
                Application.Quit();
            }

            GameSaver saver = GetComponent <GameSaver>();
            if (saver != null && scenename != "Test Scene")
            {
                if (saver.player != null)
                {
                    saver.SaveScene();
                }
            }
            if (scenename == "menu_main")
            {
                PlayerPrefs.DeleteAll();
            }
            Application.LoadLevel(scenename);
        }
    }
Пример #2
0
 void Update()
 {
     if (Input.GetKey(KeyCode.Escape))
     {
         gameSaver.SaveScene();
         Application.Quit();
     }
 }