Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Food")
        {
            headAnim.SetTrigger("Eat");
        }

        if ((other.gameObject.tag == "Slower") && (!invincible))
        {
            GetHit();
            hand.GetInvincible();
            invincible      = true;
            hand.invincible = true;

            int a = headAnim.GetLayerIndex("Invincible");
            headAnim.SetLayerWeight(a, 1.0f);

            a = bodyAnim.GetLayerIndex("Invincible");
            bodyAnim.SetLayerWeight(a, 1.0f);

            //StartCoroutine(SwitchSprite());
        }

        //if (other.gameObject.name == "Helicopter")
        //{
        //    anim.SetTrigger("EatHelicopter");
        //}
    }
Exemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Food")
        {
            anim.SetTrigger("Eat");
        }

        if ((other.gameObject.tag == "Slower") && (!invincible))
        {
            GetHit();
            hand.GetInvincible();
            invincible      = true;
            hand.invincible = true;
        }

        //if (other.gameObject.name == "Helicopter")
        //{
        //    anim.SetTrigger("EatHelicopter");
        //}
    }