private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "EnemyCollider") { EnemyDestroyController enemyDestroyController = collision.transform.parent.GetComponent <EnemyDestroyController>(); enemyDestroyController.DestroyByPlayer(); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "InnerBorder") { Destroy(this.gameObject); } if (collision.gameObject.tag == "EnemyCollider") { EnemyDestroyController enemyDestroyController = collision.transform.parent.GetComponent <EnemyDestroyController>(); enemyDestroyController.DestroyByPlayer(); Destroy(this.gameObject); } }
void IgniteNuke() { if (this.amountBombs > 0) { foreach (Transform enemy in this.enemiesGaOb.transform) { EnemyDestroyController enemyDestroyController = enemy.GetComponent <EnemyDestroyController>(); enemyDestroyController.DestroyByPlayer(); } foreach (Transform enemyBullet in this.bulletsGaOb.transform) { Destroy(enemyBullet.gameObject); } this.amountBombs--; } }
void IgniteNuke() { if (amountBombs > 0) { // Loop through enemy in enemies and destroy all of them foreach (Transform enemy in enemiesGameObject.transform) { EnemyDestroyController enemyDestroyController = enemy.GetComponent <EnemyDestroyController>(); enemyDestroyController.DestroyByPlayer(); } foreach (Transform bullet in bulletsGameObject.transform) { Destroy(bullet); } amountBombs--; } }