Exemple #1
0
    void Start()
    {
        AudioManager.instance.Play("MenuBGMusic");
        Time.timeScale = 1;
        EMMotionManager.Open("MenuStartTitle");
        StartCoroutine(OpenEMAnimationDelayBySeconds(0.5f, "MenuStartAction"));
        menuCamera.GetComponent <Animation>().Play("StartMenu_CameraFlyIn");

        Component[] mainMenuTransform = mainMenu.GetComponentsInChildren(typeof(Transform), true);
        mainMenuBlur = Instantiate(originalBlur);
        foreach (Transform item in mainMenuTransform)
        {
            if (item.gameObject.name == "Blur")
            {
                item.GetComponent <Image>().material = mainMenuBlur;
            }
        }
        Component[] levelSelectTransform = levelSelectMenu.GetComponentsInChildren(typeof(Transform), true);
        levelSelectBlur = Instantiate(originalBlur);
        foreach (Transform item in levelSelectTransform)
        {
            if (item.gameObject.name == "Blur")
            {
                item.GetComponent <Image>().material = levelSelectBlur;
            }
        }
    }
 public void OpenAPI()
 {
     EMMotionManager.Open("HedgehogOpenClose");
 }
Exemple #3
0
    void Update()
    {
        if (hardInput.GetKeyDown("PauseGame"))
        {
            pauseMenuActive = !pauseMenuActive;

            // Opens Menu
            if (pauseMenuActive)
            {
                this.transform.Find("Menu").Find("PauseMenu").gameObject.SetActive(true);
                // If player is dead keep screen blur the same
                if (!player.GetComponent <PlayerBehaviour>().dead)
                {
                    gameMenus.transform.Find("ScreenBlur").GetComponent <Animate>().DoAnimation();
                    weakFrostedGlass.SetFloat("_Radius", 0f);
                    weakFrostedGlassNew = 4f;
                    ActivateOrDeactivatePlayer(false);
                }
                gameMenus.transform.Find("PauseMenu").GetComponent <Animate>().DoAnimation();
                strongFrostedGlass.SetFloat("_Radius", 0f);
                strongFrostedGlassNew = 24f;
                Cursor.visible        = true;
                Cursor.lockState      = CursorLockMode.None;
                isPaused = true;
            }
            // Closes Menu
            else
            {
                animCloseStart = true;
                // If player is dead keep screen blur the same
                if (!player.GetComponent <PlayerBehaviour>().dead)
                {
                    gameMenus.transform.Find("ScreenBlur").GetComponent <Animate>().DoAnimation();
                    weakFrostedGlass.SetFloat("_Radius", 4f);
                    weakFrostedGlassNew = 0f;
                    ActivateOrDeactivatePlayer(true);
                }
                gameMenus.transform.Find("PauseMenu").GetComponent <Animate>().DoAnimation();
                strongFrostedGlass.SetFloat("_Radius", 24f);
                strongFrostedGlassNew = 0f;
                UnPauseGame();
                if (!triggerManager.usingButtonPress)
                {
                    Cursor.visible   = false;
                    Cursor.lockState = CursorLockMode.Locked;
                }
                isPaused = false;
            }
        }
        // GameOver Screen
        if (player.GetComponent <PlayerBehaviour>().dead&& !deadActive)
        {
            EMMotionManager.Open("GameOver");
            ActivateOrDeactivatePlayer(false);
            gameMenus.transform.Find("ScreenBlur").GetComponent <Animate>().DoAnimation();
            gameMenus.transform.Find("ScreenDarken").GetComponent <Animate>().DoAnimation();
            weakFrostedGlass.SetFloat("_Radius", 0f);
            weakFrostedGlassNew = 4f;
            deadActive          = true;
        }

        // Pauses Time!
        if (isPaused && !gameMenus.transform.Find("PauseMenu").GetComponent <Animation>().IsPlaying("PauseMenu"))
        {
            PauseGame();
        }

        // Updates Frosted Glass
        strongFrostedGlass.SetFloat("_Radius", Mathf.Lerp(strongFrostedGlass.GetFloat("_Radius"), strongFrostedGlassNew, Time.deltaTime * smooth));
        weakFrostedGlass.SetFloat("_Radius", Mathf.Lerp(weakFrostedGlass.GetFloat("_Radius"), weakFrostedGlassNew, Time.deltaTime * smooth));

        if (animCloseStart)
        {
            if (!this.transform.Find("Menu").Find("PauseMenu").GetComponent <Animation>().isPlaying)
            {
                animCloseStart = false;
                this.transform.Find("Menu").Find("PauseMenu").gameObject.SetActive(false);
            }
        }
    }
Exemple #4
0
    // Delay for Open Animation (EM)
    private IEnumerator OpenEMAnimationDelayBySeconds(float time, string name)
    {
        yield return(new WaitForSeconds(time));

        EMMotionManager.Open(name);
    }