예제 #1
0
    public void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == ignoreTag)
        {
            return;
        }

        if (other.tag == "Enemy" || other.tag == "Player")
        {
            CharacterData characterData = other.GetComponent <CharacterData>();
            base.ApplyDamage(characterData);

            foreach (Effect effect in base.effects)
            {
                characterData.AddEffect(effect);
            }
        }
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == ignoreTag)
        {
            return;
        }
        print(collision.name);
        if (collision.tag == "Enemy" || collision.tag == "Player")
        {
            CharacterData characterData = collision.GetComponent <CharacterData>();
            base.ApplyDamage(characterData);

            foreach (Effect effect in base.effects)
            {
                characterData.AddEffect(effect);
            }
            Destroy(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }