Exemple #1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if ((collision.gameObject.tag != "blobbounce" && collision.gameObject.tag != "Player") && !connected)
        {
            SoundManagerScript.PlaySound("splat");

            connected          = true;
            rb.isKinematic     = true;
            rb.velocity        = Vector3.zero;
            rb.angularVelocity = 0;
            rb.constraints     = RigidbodyConstraints2D.FreezeAll;
            //transform.localScale = new Vector3(10, 10);

            if (collision.gameObject.tag == "blob" && transform.localScale.x <= sizeIncrease)
            {
                wait = true;

                transform.localScale = new Vector3(.8f * sizeIncrease, .8f * sizeIncrease, 0);
                if (connectedTo == null)
                {
                    connectedTo = collision.gameObject.GetComponent <GoopShoot>();
                    if (connectedTo.alsoConnectedTo == null)
                    {
                        connectedTo.alsoConnectedTo = this;
                    }
                }
            }
        }
    }
Exemple #2
0
 // Start is called before the first frame update
 void OnEnable()
 {
     colliderOfObj.enabled = true;
     alsoConnectedTo       = null;
     connectedTo           = null;
     gettingremoved        = false;
     wait = true;
     rb   = this.GetComponent <Rigidbody2D>();
     rb.AddForce(transform.right * shootForce);
 }
Exemple #3
0
 public void InstantRemove()
 {
     if (alsoConnectedTo)
     {
         alsoConnectedTo.RemoveBlob();
     }
     alsoConnectedTo      = null;
     connectedTo          = null;
     gettingremoved       = true;
     rb.isKinematic       = false;
     rb.constraints       = RigidbodyConstraints2D.None;
     connected            = false;
     transform.localScale = new Vector2(1, 1);
     this.gameObject.SetActive(false);
 }