Пример #1
0
    // Waits for the completed door animation and then loads the next scene
    IEnumerator LoadNextScene(Animator doorAnim)
    {
        yield return(new WaitUntil(() => doorAnim.GetCurrentAnimatorStateInfo(0).IsName("Door_open") && doorAnim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f));

        StartCoroutine(FadeSprite.Fade(GetComponent <Rigidbody2D>(), gameObject.GetComponentInChildren <SpriteRenderer>(), 1f, 0f, 2f));
        yield return(new WaitForSeconds(2.5f));

        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
Пример #2
0
    void Start()
    {
        body     = gameObject.GetComponent <Rigidbody2D>();
        animator = gameObject.GetComponent <Animator>();
        heldItem = null;
        input    = GameObject.FindObjectOfType <InputManager>();


        layerMask = (int)0x7FFFFFFF;


        for (int i = 0; i < avoidLayers.Length; i++)
        {
            layerMask ^= (1 << avoidLayers[i]);
        }

        // Lock movement and fade in
        StartCoroutine(FadeSprite.Fade(GetComponent <Rigidbody2D>(), gameObject.GetComponentInChildren <SpriteRenderer>(), 0f, 1f, 2f));
    }
Пример #3
0
    private void Start()
    {
        if (facingRight == true)
        {
            Flip();
        }

        layerMask = (int)0x7FFFFFFF;


        for (int i = 0; i < avoidLayers.Length; i++)
        {
            layerMask ^= (1 << avoidLayers[i]);
        }

        anim = gameObject.GetComponentInChildren <Animator>();

        // Lock movement and fade in
        StartCoroutine(FadeSprite.Fade(GetComponent <Rigidbody2D>(), gameObject.GetComponentInChildren <SpriteRenderer>(), 0f, 1f, 2f));
        //gameObject.GetComponentInChildren<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0.5f);
    }