can't leave room during boss fight

main
Matthew Kalahiki 4 years ago
parent d5258cc72c
commit 0cf89255f4

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

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

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

Loading…
Cancel
Save