Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.M))
        {
            AudioLibrary.PlayTetherPlacementSound();
        }

        if (Input.GetKeyDown(KeyCode.N))
        {
            AudioLibrary.PlayTetherRewindSound();
        }
    }
Ejemplo n.º 2
0
    IEnumerator TetherBackAnimation(int stateToLoad)
    {
        //Debug.Log("TetherBackAnimation coroutine started");

        // The tether menu should be gone by this point

        // Make Margot play her tether animation
        // start animation
        playerScript.PlayTetherAnimation();
        AudioLibrary.PlayTetherRewindSound();

        // Play ripple out particle effect
        ParticleSystem ripples = Instantiate(Resources.Load("Prefabs/ParticlesRippleOut") as GameObject, GameManager.GetPlayer().transform).GetComponent <ParticleSystem>();

        ripples.transform.position = GameManager.GetPlayer().transform.position;
        ripples.Play();

        // Temporary way of delaying; should eventually have the animation controller tell this script that Margot's animation has finished
        yield return(new WaitForSeconds(0.5f));

        /*
         *      while (false)
         *      {
         *              //  Wait for Margot's animation to finish
         *              yield return null;
         *      }
         */

        // Next, start two simultaneous actions
        //  (1) Make the screen transition play
        tetherTransition.SetFadeOut();
        tetherShaderTransition.SetFadeOut();

        //	(2) Make the timeline arrow move directly above the previous tether point
        SetArrowTarget(stateToLoad, false, false);

        while (!ArrowReachedTarget() || tetherTransition.TransitionInProgress())
        {
            // Wait for both conditions to finish
            yield return(null);
        }

        Destroy(ripples.gameObject);

        // Load the desired state via LevelStateManager
        LoadTetherPoint(stateToLoad);
        //RemoveTimeTetherIndicator(stateToLoad + 1);
        //LevelStateManager.loadTetherPoint(stateToLoad);

        // How long to wait on the black screen
        yield return(new WaitForSeconds(0.3f));

        // Now that the state has been loaded, make the transition fade back in
        playerScript.PlayReappearAnimation();
        yield return(new WaitForSeconds(0.1f));

        tetherTransition.SetFadeIn();
        tetherShaderTransition.SetFadeIn();

        // Play ripple in particle effect
        ripples = Instantiate(Resources.Load("Prefabs/ParticlesRippleIn") as GameObject, GameManager.GetPlayer().transform).GetComponent <ParticleSystem>();
        ripples.transform.position = GameManager.GetPlayer().transform.position;
        ripples.Play();

        while (tetherTransition.TransitionInProgress())
        {
            // Wait for the transition in to finish
            yield return(null);
        }

        // When the transition is done, start these simultaneous actions
        //  (1) Make Margot play her appear animation

        ripples.enableEmission = false;

        yield return(new WaitForSeconds(0.2f));

        //	(2) Move the timeline arrow to the middle position in front of the tether point we just reverted to
        SetArrowTarget(stateToLoad, true, false);

        // TODO need compound boolean
        while (!ArrowReachedTarget())
        {
            // Wait for both conditions to finish
            yield return(null);
        }

        yield return(new WaitForSeconds(0.5f));

        Destroy(ripples.gameObject);

        // Now that the process has finished, restore control to the player
        // TODO
        tetherUIState = TetherUIState.GAMEPLAY;
        //GameManager.setPause(false);
        GameManager.inst.ExitPauseState();
        CursorManager.inst.lockCursorType = false;
        CursorManager.inst.OnCursorBoundsUpdated();
    }