Пример #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
            }
        }
    }