private void OnTriggerEnter(Collider other) { enemySpawnManager = GameObject.Find("Enemy Spawn Manager").GetComponent <EnemySpawnManager>(); playerStats = GameObject.Find("GameManager").GetComponent <PlayerStats>(); if (other.gameObject.CompareTag("Range Enemy")) { prefabs.SetActive(false); rangeEnemy = other.GetComponent <RangeEnemy>(); rangeEnemy.healthRangeEnemy -= playerStats.attackPower; if (rangeEnemy.healthRangeEnemy <= 0) { other.gameObject.SetActive(false); rangeEnemy.healthRangeEnemy = 100; other.gameObject.transform.position = enemySpawnManager.RandomPosition(); rangeEnemy.weaponIsActive = true; } } if (other.gameObject.CompareTag("Melee Enemy")) { prefabs.SetActive(false); meleeEnemy = other.GetComponent <MeleeEnemy>(); meleeEnemy.healthMeleeEnemy -= playerStats.attackPower; if (meleeEnemy.healthMeleeEnemy > 0) { meleeEnemy.SkeletonAnim.SetTrigger("GetDamage"); } } }
IEnumerator MeleeDeath() { yield return(new WaitForSeconds(5f)); isReady = true; gameObject.SetActive(false); healthMeleeEnemy = 100; transform.position = enemySpawnManager.RandomPosition(); }