Beispiel #1
0
    void OnCollisionEnter(Collision collision)
    {
        // prevent double touch on a brick already in the process of destruction
        if (m_IsDestroyed)
        {
            return;
        }

        if (collision.transform.GetComponent <Ball>() != null)
        {
            if (m_IsBrickFalling)
            {
                m_Creator.OnBrickFallingTouched(this, true);
            }
            else
            {
                m_Creator.NonFallingBrickTouchedByBall(this);
            }
        }
        else if (collision.transform.GetComponent <Ground>() != null)
        {
            if (m_IsBrickFalling)
            {
                m_Creator.OnBrickFallingTouched(this, false);
            }
        }
    }