void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.tag == "Player" && currentMapBoundary == this)
        {
            UpdateMapBounds();
            camScript.ActivateTransition();

            GameManager.instance.switchState(new TransitionState(GameManager.instance));
        }
    }
Exemple #2
0
    IEnumerator EnterHouse()
    {
        if (elevator)
        {
            Animator anim = transform.parent.GetComponent <Animator>();
            anim.SetTrigger("Open");
            StartCoroutine(ElevatorFadePlayer(2));
            yield return(new WaitForSeconds(1f));
        }
        CameraFX.FadeIn();
        AudioManager.PlayOneShot(audioOnUse);
        yield return(new WaitForSeconds(1f));

        player.transform.position = houseLocation.position;


        if (elevator)
        {
            StopAllCoroutines();
            player.GetComponent <SpriteRenderer>().color = Color.white;
        }

        if (GetComponent <SpriteRenderer>() != null)        // Flip the player sprite if they are entering a house
        {
            player.transform.localScale = new Vector3(player.transform.localScale.x * spawnDirection, player.transform.localScale.y, player.transform.localScale.z);
        }
        mb.CalculateMapBounds();
        mb.UpdateMapBounds();

        GameManager.instance.switchState(new TransitionState(GameManager.instance));

        CameraFollow2D camScript = Camera.main.GetComponent <CameraFollow2D>();

        camScript.enabled = true;
        camScript.ActivateTransition();
        camScript.UpdateToMapBounds();
        CameraFX.FadeOut();
    }