public void togglePauseMenu(bool open = true)
    {
        if (open)
        {
            prevState = playerController.State.Movement;
        }
        if (open)
        {
            gameManager.Instance.playerCtrl.cutScenePrep();
        }

        gameManager.Instance.playerCtrl.state = open ? playerController.State.Wait : prevState;

        PausePanel.SetActive(open);
        PauseMenu.SetActive(open);
        CheatsMenu.SetActive(false);
        ControlsMenu.SetActive(false);
        ControlSchemeArrow.SetActive(false);
        state = open ? MenuState.Pause : MenuState.Closed;
    }
Ejemplo n.º 2
0
    public void setPlayer()
    {
        GameObject atlas = GameObject.Find("Atlas");

        if (SceneManager.GetActiveScene().name == "Main Menu")
        {
            return;
        }

        if (atlas)
        {
            instance.player = atlas;
        }
        else
        {
            instance.player = createInstance("RoomSetup/Atlas", Vector3.zero);
        }
        instance.playerHanger = instance.player.transform.Find("AtlasSprite/Hanger");
        instance.playerCtrl   = instance.player.GetComponent <playerController>();

        if (GameObject.Find("GameCanvas"))
        {
            instance.canvasCtrl = GameObject.Find("GameCanvas").GetComponent <canvasController>();
        }

        if (instance.canSetPosition && instance.player)
        {
            instance.player.transform.position = new Vector3(playerStartX, playerStartY, 0);
            Physics2D.SyncTransforms();
            instance.player.GetComponent <characterController>().setCollidable(true);
            playerController.State playerState = playerCtrl.state;
            if (instance.playerCtrl.state == playerController.State.Wait)
            {
                playerCtrl.returnToMovement(playerState);
                canvasCtrl.doBlackout(false);
            }
        }
        instance.canSetPosition = true;
    }