示例#1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // if (other.tag == "Ground")
        // {
        //      Debug.Log("Collided with Ground");
        //     flightTime = 5;
        //     flightStarted = false;
        // }

        if (other.tag == "owl")
        {
            Debug.Log("Collided with owl");
            uncontrollable = true;
            Vel            = new Vector2(0, -5);
            duck_rot.SetZ(0);
            fall.Play();
            if (gameManagerScript.hasTwig == true)
            {
                gameManagerScript.hasTwig = false;
            }
        }

        if (other.tag == "Twiggy")
        {
            Debug.Log("Player collided with twiggy");
            StickyScript twiggyStuff = other.gameObject.GetComponent <StickyScript>();
            twiggyStuff.DoTwiggyThings();
        }

        if (other.tag == "Nest" && gameManagerScript.CanBuild())
        {
            Debug.Log("Collided with Nest object");
            buildNestScript.AdvanceNestStage();
        }

        if (other.tag == "Respawn")
        {
            this.transform.position = new Vector2(90, 1);
            if (gameManagerScript.hasTwig == true)
            {
                gameManagerScript.hasTwig = false;
            }
        }
    }