Example #1
0
    private IEnumerator TransitionOut()
    {
        //wipe to black
        TransitionFader.WipeToBlackFromCenter(transitionTime);

        // Wait while the camera moves to transition and the screen wipes to black
        yield return(new WaitForSeconds(transitionTime));

        // Turn the puzzle off
        zodiacPuzzle.ChangeMode(ZodiacPuzzle.Mode.Off, true);

        // unlock the player
        PlayerMovement player;

        if (PlayerManager.IsLoaded)
        {
            player = PlayerManager.CurrentPlayer.GetComponent <PlayerMovement>();
        }
        else
        {
            player = GameObject.FindWithTag("Player").GetComponent <PlayerMovement>();
        }
        player.ChangeState(PlayerMovement.PlayerState.Waiting);

        //wipe to black
        TransitionFader.FadeFromBlack(transitionTime);

        // Deactivate all children. Remember that THIS object must remain active or the coroutine dies!
        for (int i = 0; i < transform.childCount; i++)
        {
            transform.GetChild(i).gameObject.SetActive(false);
        }

        //cooldown for re-entering..
        _isCoolingDown = true;

        yield return(new WaitForSeconds(cooldownPeriod));

        _isCoolingDown = false;
    }