예제 #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        KinematicBubble kinematicBubble = collision.gameObject.GetComponent <KinematicBubble>();

        if (kinematicBubble != null && collision.gameObject.CompareTag(gameObject.tag))
        {
            kinematicBubble.CountNumbersOfMyColliderAndDestroyIfNeeded();
        }
    }
예제 #2
0
    private void ChangeToKinematicBubble()
    {
        GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Kinematic;
        KinematicBubble kinematicBubble = gameObject.AddComponent(typeof(KinematicBubble)) as KinematicBubble;

        kinematicBubble.SetTextCanvas(textCanvas);


        Destroy(myTrailRenderer);
        // myAnimator.SetBool("BubbleBlow", true);


        rigidbody2d.gravityScale = 1;
        gameObject.layer         = 9; // bubble
        kinematicBubble.CountNumbersOfMyColliderAndDestroyIfNeeded();
        Destroy(this);
    }
예제 #3
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        KinematicBubble kinematicBubble = other.collider.GetComponent <KinematicBubble>();

        if (kinematicBubble)
        {
            if (!kinematicBubbles.Contains(kinematicBubble))
            {
                kinematicBubbles.Add(kinematicBubble);
                kinematicBubble.CountNumbersOfMyColliderAndDestroyIfNeeded();
                // Debug.Log(kinematicBubble.name + "called from superBubble");

                //myAnimator.SetBool(fireBubbleBlowBoolName, true);

                Destroy(gameObject, 0.1f);
                gameObject.layer = 11;  // dont do physical action
            }
        }
    }