예제 #1
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();
        }
    }
예제 #2
0
    public void OnButtonPress(string type)
    {
        if (type == "start")
        {
            if (MainMenuBtn.confirmNew)
            {
                // Reset all global values and switch to first scene
                GlobalControl.canContinue = true;
                GlobalControl.resetPlayer();
                GlobalControl.resetObjects();
                GlobalControl.respawnAll();

                StartCoroutine(SceneSwitch("Start_"));
            }
            else
            {
                MainMenuBtn.confirmNew = true;
            }
        }
        else if (type == "continue")
        {
            if (GlobalControl.canContinue)
            {
                StartCoroutine(SceneSwitch2(GlobalControl.prevArea));
            }
        }
        else if (type == "controls")
        {
            MainMenuBtn.inControl = true;
        }
        else if (type == "trophy")
        {
            MainMenuBtn.inTrophy = true;
        }
        else if (type == "exit")
        {
            MainMenuBtn.confirmNew = false;
            MainMenuBtn.inControl  = false;
            MainMenuBtn.inTrophy   = false;
        }
    }