can't leave room during boss fight

main
Matthew Kalahiki 4 years ago
parent d5258cc72c
commit 0cf89255f4

@ -1728,6 +1728,9 @@ MonoBehaviour:
timeBetween: 4 timeBetween: 4
enemyHealth: 100 enemyHealth: 100
damageTaken: 10 damageTaken: 10
doors:
- {fileID: 1787950110}
- {fileID: 1115280552}
--- !u!95 &453535362 --- !u!95 &453535362
Animator: Animator:
serializedVersion: 3 serializedVersion: 3

@ -13,6 +13,7 @@ public class DaisyBoss : MonoBehaviour
private EnemyHealthBar ehb; private EnemyHealthBar ehb;
public int enemyHealth; public int enemyHealth;
public int damageTaken; public int damageTaken;
public GameObject[] doors;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
@ -22,6 +23,10 @@ public class DaisyBoss : MonoBehaviour
enemyHealthBar = GameManager.Instance.GetEnemyHealthBar(); enemyHealthBar = GameManager.Instance.GetEnemyHealthBar();
ehb = enemyHealthBar.GetComponent<EnemyHealthBar>(); ehb = enemyHealthBar.GetComponent<EnemyHealthBar>();
enemyHealthBar.gameObject.SetActive(true); enemyHealthBar.gameObject.SetActive(true);
foreach (GameObject i in doors) {
i.GetComponent<Collider2D>().isTrigger = false;
i.GetComponent<LoadLevel>().enabled = false;
}
} }
@ -37,6 +42,11 @@ public class DaisyBoss : MonoBehaviour
ehb.SetHealth(enemyHealth); ehb.SetHealth(enemyHealth);
if (enemyHealth <=0) { if (enemyHealth <=0) {
enemyHealthBar.SetActive(false); enemyHealthBar.SetActive(false);
foreach (GameObject i in doors)
{
i.GetComponent<Collider2D>().isTrigger = true;
i.GetComponent<LoadLevel>().enabled = true;
}
Destroy(gameObject); Destroy(gameObject);
} }

@ -20,7 +20,7 @@ public class LoadLevel : MonoBehaviour
private void OnTriggerEnter2D(Collider2D collision) private void OnTriggerEnter2D(Collider2D collision)
{ {
if (collision.CompareTag("Player")) if (collision.CompareTag("Player") && enabled)
{ {
GameManager.Instance.LoadLevel(LevelName, whereTo); GameManager.Instance.LoadLevel(LevelName, whereTo);
} }

Loading…
Cancel
Save