예제 #1
0
    void Update()
    {
        if (OnMainMenu)
        {
            return;
        }
        if (Input.GetKeyDown(KeyCode.Escape) && !RecipeSystem.IsShowing())
        {
            if (showMenu)
            {
                exitButton.Set();
            }
            else
            {
                SoundManager.PLAY_SOUND("Scroll", 1, 1.5f);
            }

            showMenu = !showMenu;
            for (int i = 0; i < transform.childCount; i++)
            {
                transform.GetChild(i).gameObject.SetActive(showMenu);
            }
            MenuOn = showMenu;
            if (player != null)
            {
                player.mouseLook.enabled = !showMenu;
            }
            if (showMenu)
            {
                Cursor.lockState = CursorLockMode.None;
            }
            else
            {
                Cursor.visible = false;
                if (player != null && player.controller != null)
                {
                    player.controller.enabled = true;
                }
            }
        }
        ApplyBaseSettings();
    }
예제 #2
0
    void Update()
    {
        if (playerCam != null)
        {
            playerCam.orthographicSize = CamHeight;
        }

        //Tutorial
        time += Time.deltaTime;
        if (time > 1 && !extend.finished && sprint.finished)
        {
            TutorialManager.SetTutorial(extend, gameObject.transform.position + new Vector3(250, -100, 0));
        }

        if (RecipeSystem.IsShowing())
        {
            holdExtendView = false;
        }

        if (Input.GetKey(KeyCode.M) && !RecipeSystem.IsShowing())
        {
            holdExtendDelay += Time.deltaTime;
            holdExtendView   = holdExtendDelay > 0.5f & show;
            if (holdExtendView)
            {
                TutorialManager.FinishTutorial(extend);
            }
        }
        if (Input.GetKeyUp(KeyCode.M) && !RecipeSystem.IsShowing())
        {
            holdExtendDelay = 0;
            if (!holdExtendView)
            {
                ToggleMap();
            }
            holdExtendView = false;
        }

        title.text = "<color=" + (show ? "#dfdfa4" : "maroon") + ">M</color>ap";

        if (turn > 0)
        {
            turn -= rollDownSpeed;
        }
        else if (turn < 0)
        {
            turn += rollDownSpeed;
        }

        if (holdExtendView)
        {
            CamHeight               = Mathf.Lerp(CamHeight, 70f, Time.deltaTime * 2f);
            transform.position      = Vector3.Lerp(transform.position, new Vector3(Screen.width / 2f, Screen.height + 10 + GetWobble(), transform.localPosition.z), Time.deltaTime * 2f);
            transform.localScale    = Vector3.Lerp(transform.localScale, 1.75f * new Vector3(baseScale.x + GetWobble(1, 0.02f) - 0.1f - (show ? -0.1f : 0.1f), baseScale.y + GetWobble(1, 0.02f) - 0.1f - (show ? -0.1f : 0.1f), 1), Time.deltaTime * 2f);
            transform.localRotation = Quaternion.Euler(transform.localEulerAngles.x, transform.localEulerAngles.y, Mathf.LerpAngle(transform.localEulerAngles.z, turn, Time.deltaTime * 3.5f));
        }
        else
        {
            CamHeight = Mathf.Lerp(CamHeight, BaseCam, Time.deltaTime * 2f);
            transform.localPosition = Vector3.Lerp(transform.localPosition, new Vector3(basePos.x, basePos.y + GetWobble(), transform.localPosition.z), Time.deltaTime * 2f);
            transform.localScale    = Vector3.Lerp(transform.localScale, new Vector3(baseScale.x + GetWobble(1, 0.02f) - 0.1f - (show ? -0.1f : 0.1f), baseScale.y + GetWobble(1, 0.02f) - 0.1f - (show ? -0.1f : 0.1f), 1), Time.deltaTime * 2f);
            transform.localRotation = Quaternion.Euler(transform.localEulerAngles.x, transform.localEulerAngles.y, Mathf.LerpAngle(transform.localEulerAngles.z, turn, Time.deltaTime * 3.5f));
        }

        Vector3 targetScale, targetPos;

        if (show)
        {
            targetPos   = baseBottomPos;
            targetScale = baseBottomScale;
        }
        else
        {
            targetPos   = new Vector3(0, -160, 0);
            targetScale = new Vector3(1, 0.25f, 1);
        }
        bottom.transform.localPosition = Vector3.Lerp(bottom.transform.localPosition, targetPos, Time.deltaTime * 3);
        bottom.transform.localScale    = Vector3.Lerp(bottom.transform.localScale, targetScale, Time.deltaTime * 5);
    }