Ejemplo n.º 1
0
    public void Unpause()
    {
        GetComponent <FloatingIconManager>().SetAllIconsVisible(true);

        if (TabButtonPanel.activeSelf)
        {
            TabButtonPanel.SetActive(false);
        }

        if (useGreyscale)
        {
            GreyscaleScreen(false);
        }

        Crosshair.enabled = true;
        LockPlayerControls(true, true, false, 3, false);
        PauseGamePanel.SetActive(false);
        MainGamePanel.SetActive(true);
        isPaused = false;

        if (reallyPause)
        {
            foreach (var PauseEvent in PauseEvents)
            {
                PauseEvent.OnPauseEvent(false);
            }

            Time.timeScale = 1;
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        transform.SetSiblingIndex(0);

        if (inputManager.HasInputs())
        {
            UseKey       = inputManager.GetInput("Use");
            GrabKey      = inputManager.GetInput("Pickup");
            ThrowKey     = inputManager.GetInput("Throw");
            RotateKey    = inputManager.GetInput("Fire");
            CursorKey    = inputManager.GetInput("Zoom");
            InventoryKey = inputManager.GetInput("Inventory");
        }

        if (configHandler.ContainsSectionKey("Game", "Volume"))
        {
            float volume = float.Parse(configHandler.Deserialize("Game", "Volume"));
            AudioListener.volume = volume;
        }

        if (!uiInteractive)
        {
            return;
        }

        if (Input.GetKeyDown(ShowPauseMenuKey) && !isPressed && !antiSpam)
        {
            isPressed = true;
            PauseGamePanel.SetActive(!PauseGamePanel.activeSelf);
            MainGamePanel.SetActive(!MainGamePanel.activeSelf);

            StartCoroutine(AntiPauseSpam());

            if (useGreyscale)
            {
                if (!greyscaleIn)
                {
                    GreyscaleScreen(true);
                }
                else if (!greyscaleOut)
                {
                    GreyscaleScreen(false);
                }
            }

            isPaused = !isPaused;
        }
        else if (isPressed)
        {
            isPressed = false;
        }

        if (PauseGamePanel.activeSelf && isPaused && isPressed)
        {
            Crosshair.enabled = false;
            LockPlayerControls(false, false, true, 3, true);
            scriptManager.GetScript <PlayerFunctions>().enabled = false;
            GetComponent <FloatingIconManager>().SetAllIconsVisible(false);
            if (reallyPause)
            {
                foreach (var PauseEvent in PauseEvents)
                {
                    PauseEvent.OnPauseEvent(true);
                }

                Time.timeScale = 0;
            }
        }
        else if (isPressed)
        {
            Crosshair.enabled = true;
            LockPlayerControls(true, true, false, 3, false);
            scriptManager.GetScript <PlayerFunctions>().enabled = true;
            GetComponent <FloatingIconManager>().SetAllIconsVisible(true);
            if (TabButtonPanel.activeSelf)
            {
                TabButtonPanel.SetActive(false);
            }
            if (reallyPause)
            {
                foreach (var PauseEvent in PauseEvents)
                {
                    PauseEvent.OnPauseEvent(false);
                }

                Time.timeScale = 1;
            }
        }

        if (Input.GetKeyDown(InventoryKey) && !isPressed && !isPaused && !isOverlapping)
        {
            isPressed = true;
            TabButtonPanel.SetActive(!TabButtonPanel.activeSelf);
        }
        else if (isPressed)
        {
            isPressed = false;
        }

        NotificationsPanel.SetActive(!TabButtonPanel.activeSelf);

        if (TabButtonPanel.activeSelf && isPressed)
        {
            Crosshair.enabled = false;
            GetComponent <FloatingIconManager>().SetAllIconsVisible(false);
            LockPlayerControls(false, false, true, 3, true);
            HideSprites(hideType.Interact);
            HideSprites(hideType.Grab);
            HideSprites(hideType.Examine);
        }
        else if (isPressed)
        {
            Crosshair.enabled = true;
            LockPlayerControls(true, true, false, 3, false);
            GetComponent <FloatingIconManager>().SetAllIconsVisible(true);
        }

        LockScript <ExamineManager>(!TabButtonPanel.activeSelf);

        if (Notifications.Count > 3)
        {
            Destroy(Notifications[0]);
        }

        Notifications.RemoveAll(GameObject => GameObject == null);

        if (greyscale && colorGrading)
        {
            if (greyscaleIn)
            {
                if (colorGrading.saturation.value > -99)
                {
                    colorGrading.saturation.value -= Time.fixedDeltaTime * (greyscaleFadeSpeed * 20);
                }
                else if (colorGrading.saturation <= -99)
                {
                    colorGrading.saturation.Override(-100);
                }
            }

            if (greyscaleOut)
            {
                if (colorGrading.saturation.value < -1)
                {
                    colorGrading.saturation.value += Time.fixedDeltaTime * (greyscaleFadeSpeed * 20);
                }
                else if (colorGrading.saturation >= -1)
                {
                    colorGrading.saturation.Override(0);
                }
            }
        }
    }