/// <summary> /// Destroys the doll when the doll enters the Trigger Parameter /// </summary> /// <param name="collision"></param> private void OnTriggerEnter2D(Collider2D collision) { VooDooDoll doll = collision.GetComponent <VooDooDoll>(); if (!doll) { return; } if (isDestryoing) { return; } GetComponent <AudioSource>().Play(); StartCoroutine(DestroyDoll()); }
void OnCollisionEnter2D(Collision2D collision) { // get voodoo doll VooDooDoll doll = collision.transform.GetComponent <VooDooDoll>(); if (doll) { //ScoreManager.Instance.UpdateScore(scoreAdd); DOTween.Rewind(gameObject); DOTween.PlayForward(gameObject); if (tears != null) { Instantiate(tears, collision.transform.position, Quaternion.identity); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (isStuck) { return; } // get voodoo doll VooDooDoll doll = collision.transform.GetComponent <VooDooDoll>(); if (doll) { GameManager.Instance.ScoreManager.UpdateMultiplier(multiplierChanger); attachNeedle(doll.transform); isStuck = true; } }