示例#1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        MoonMove moonMove = collider.GetComponent <MoonMove>();

        if (moonMove != null)
        {
            Falling = true;
            Destroy(gameObject);
        }
    }
示例#2
0
    // called when hit star & moon
    void OnTriggerEnter2D(Collider2D collider)
    {
        // when hit star
        Star star = collider.GetComponent <Star>();

        if (star != null)
        {
            star.Live();
            Destroy(gameObject);
        }

        // when hit moon
        MoonMove moonMove = collider.GetComponent <MoonMove>();

        if (moonMove != null)
        {
            moonMove.Tremble();
            Destroy(gameObject);
        }
    }