Exemplo n.º 1
0
    void OnTriggerStay2D(Collider2D other)
    {
        Debug.Log(other.gameObject.name);
        if (other.gameObject.tag == "Enemy")
        {
            if (other.gameObject.name != "Boss")
            {
                AIController enemyController = other.gameObject.GetComponent <AIController>();
                enemyController.Wound(playerData.spellDamage);
            }
        }

        if (other.gameObject.name == "Boss")
        {
            Debug.Log("what");
            BossAIController enemyController = other.gameObject.GetComponent <BossAIController>();
            enemyController.Wound(playerData.spellDamage);
            Destroy(gameObject);
        }

        /*
         * else if (other.gameObject.tag == "Boss")
         * {
         *  BossAIController enemyController = other.gameObject.GetComponent<BossAIController>();
         *  enemyController.Wound(playerData.spellDamage);
         * }*/
        /* else if (other.gameObject.tag == "EnemyProjectile")
         * {
         * Destroy(other.gameObject.transform.parent);
         * Destroy(gameObject);
         * }
         */
        // Destroy(gameObject);
    }
Exemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Enemy")
        {
            AIController collisionEnemy = coll.gameObject.GetComponent <AIController>();
            {
                _animator.SetTrigger("attack");
                collisionEnemy.Wound(playerData.damage);
            }
        }

        else if (coll.gameObject.tag == "Boss")
        {
            Debug.Log("enemy is boss");
            BossAIController collisionEnemy = coll.gameObject.GetComponent <BossAIController>();

            _animator.SetTrigger("attack");
            collisionEnemy.Wound(playerData.damage);
        }
    }