Пример #1
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("AllyBullet"))
        {
            TakeDamage(1);
            Destroy(other.gameObject);
        }

        PotionThrowable potion = other.GetComponentInParent <PotionThrowable>();

        if (potion)
        {
            potion.Effect(this);
        }
    }
Пример #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Bullet") && myCollider.enabled)
        {
            paradeSound.Play();

            if (!isInvincible)
            {
                if (detectBullet && perfectParade)
                {
                    player.GainMana(manaGain);
                    perfectVFX.Play();
                    paradePerfectSound.Play();
                }
                else
                {
                    Instantiate(impactVFX, impactPos.position, Quaternion.identity);
                }

                Destroy(other.gameObject);
            }
            else
            {
                Rigidbody2D bullet = other.GetComponent <Rigidbody2D>();
                bullet.gameObject.tag             = "AllyBullet";
                bullet.velocity                   = -bullet.velocity - Vector2.right * -5;
                bullet.transform.localEulerAngles = new Vector3(0, -180, 0);
            }
        }

        PotionThrowable potion = other.GetComponentInParent <PotionThrowable>();

        if (potion)
        {
            thisPotion = potion;
            if (thisPotion.canBreak && perfectParade)
            {
                thisPotion.Throw();
                paradeSound.Play();
            }
        }
    }