//loads result scene
    public void loadResult()
    {
        GlobalControl gc = GameObject.Find("GlobalControl").GetComponent <GlobalControl>();

        gc.save();
        SceneManager.LoadScene("result");
    }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        if (inRange && Input.GetKeyDown("w"))
        {
            // Open or close reactor menu
            if (ReactorManage.open)
            {
                InteractText.type  = "rest";
                ReactorManage.open = false;
                Cursor.visible     = false;
            }
            else
            {
                InteractText.type    = "";
                ReactorManage.open   = true;
                Cursor.visible       = true;
                GlobalControl.toSave = true;
                GlobalControl.save();
            }

            // Set new respawn point & full restore
            GlobalControl.checkpoint = gameObject.name;
            GlobalControl.healthCurr = GlobalControl.healthMax;
            GlobalControl.energyCurr = GlobalControl.energyMax;

            // Respawn all enemies
            GlobalControl.respawnAll();
        }
    }
Esempio n. 3
0
    //load scene with name
    public void loadScene(string name)
    {
        string curName = SceneManager.GetActiveScene().name;

        //saves current scene information
        GlobalControl gc       = GameObject.Find("GlobalControl").GetComponent <GlobalControl>();
        SceneInfo     curscene = new SceneInfo();

        curscene.sceneName = curName;
        gc.scenes.Push(curscene);
        gc.sceneInformation = null;
        gc.save();

        SceneManager.LoadScene(name);
    }
Esempio n. 4
0
    //load previous scene
    public void loadBack()
    {
        GlobalControl gc = GameObject.Find("GlobalControl").GetComponent <GlobalControl>();

        if (gc.scenes.Count <= 0)//when there is no previous scene
        {
            Debug.Log("There is no previous scene");
            return;
        }
        SceneInfo si    = gc.scenes.Pop(); //the previous scene
        string    sName = si.sceneName;    //gets the previous scene's name

        gc.save();                         //save current data
        gc.sceneInformation = si;          //passes scene information to restore
        SceneManager.LoadScene(sName);
    }
Esempio n. 5
0
    public void loadEncounter()
    {
        string curName = SceneManager.GetActiveScene().name;

        //saves current scene information
        GlobalControl     gc       = GameObject.Find("GlobalControl").GetComponent <GlobalControl>();
        SceneInfo_dungeon curscene = new SceneInfo_dungeon();

        curscene.pos_x   = pos_x;
        curscene.pos_y   = pos_y;
        curscene.enemies = enemies;

        gc.scenes.Push(curscene);
        SceneInfo_encounter nsi = new SceneInfo_encounter();

        nsi.monsters        = encounter.monsters;
        gc.sceneInformation = nsi;
        gc.save();

        SceneManager.LoadScene("encounter");
    }
 // Section Header Button Press
 public void ChangeMenu(string menu)
 {
     if (MenuBackground.inMenu &&
         (menu == "inventory" || menu == "help" || menu == "exit" ||
          (menu == "map" && GlobalControl.mapUnlocked) ||
          (menu == "enemies" && GlobalControl.counter_1 > 0) ||
          (menu == "reports" && GlobalControl.data > 0)))
     {
         btn = "";
         if (menu != "exit")
         {
             GlobalControl.menu = menu;
         }
         else
         {
             MenuBackground.inMenu     = false;
             GlobalControl.canContinue = true;
             GlobalControl.toSave      = true;
             GlobalControl.save();
             StartCoroutine(SceneSwitch("Main Menu"));
         }
     }
 }