private IEnumerator DelayColliderActivation(EdgeCollider2D c, BossFightShaman boss) { yield return(new WaitForSeconds(timeToDie + 2f)); c.enabled = true; boss.FightStarted = false; boss.wasp_spawned = false; boss.stopFight = false; }
public void DieWithFade() { if (!dead) { rb.isKinematic = true; rb.velocity = Vector2.zero; dead = true; StopAnimation(); animator.SetTrigger("Death"); //fadedelay aumentato a 0.5 per far andare animazione morte CameraFade.StartAlphaFade(Color.black, false, timeToDie * 2f, 0.5f); // Fades out the screen to black StartCoroutine(ResetScene()); if (SceneManager.GetActiveScene().name == "Level3_Maya") { //GameObject.Find("LockedDoor").GetComponent<LockedDoorManager>().Reset(); foreach (GameObject d in GameObject.FindGameObjectsWithTag("DoorSpawner")) { d.GetComponent <DoorSpawnEvent>().Open(); } GameObject.FindGameObjectWithTag("Boulder").GetComponent <BoulderManager>().Set_Reset_Boulder(false); foreach (GameObject g in GameObject.FindGameObjectsWithTag("SpawnedSkeleton")) { g.SetActive(false); } BossFightShaman boss = GameObject.FindGameObjectWithTag("Boss").GetComponent <BossFightShaman>(); boss.stopFight = true; boss.phase = 0; //boss.FightStarted = false; foreach (GameObject g in GameObject.FindGameObjectsWithTag("Sun")) { g.GetComponent <sun_manager>().activ = false; g.GetComponent <SpriteRenderer>().sortingOrder = 0; g.transform.GetChild(0).gameObject.SetActive(false); } boss.phase1.SetActive(true); boss.phase2.SetActive(false); boss.phase3.SetActive(false); StartCoroutine(DelayColliderActivation(boss.GetComponent <EdgeCollider2D>(), boss)); //boss.wasp_spawned = false; boss.wasp.transform.position = boss.waspSpawn.transform.position; boss.wasp.SetActive(false); boss.SunNumber = 0; } else if (SceneManager.GetActiveScene().name == "Level1" || SceneManager.GetActiveScene().name == "Jungle") { gameObject.transform.parent = null; } } }