private void EndGame() { joystick.GetComponent <Image>().raycastTarget = false; pause.enabled = false; spawn.SetActive(false); Player.instance.isReversed = false; Player.instance.ShieldEnd(); Player.instance.seeingEnding = true; GameObject[] targetObj = FindObjectsOfType <GameObject>(); foreach (GameObject obj in targetObj) { if (obj.activeInHierarchy) { if (obj.CompareTag("Spear")) { obj.SetActive(false); } else if (obj.CompareTag("Indicator")) { obj.SetActive(false); } else if (obj.CompareTag("Enemy")) { TurtleFollow turtleFollow = obj.GetComponent <TurtleFollow>(); TurtleLinear turtleLinear = obj.GetComponent <TurtleLinear>(); TurtleBlinder turtleBlinder = obj.GetComponent <TurtleBlinder>(); TurtleBoom turtleBoom = obj.GetComponent <TurtleBoom>(); TurtleConfuser turtleConfuser = obj.GetComponent <TurtleConfuser>(); TurtleSpear turtleSpear = obj.GetComponent <TurtleSpear>(); TurtleSuddenAttack turtleSuddenAttack = obj.GetComponent <TurtleSuddenAttack>(); TurtleSummoner turtleSummoner = obj.GetComponent <TurtleSummoner>(); TurtleSummons turtleSummons = obj.GetComponent <TurtleSummons>(); if (turtleFollow != null) { turtleFollow.OnDead(false); } else if (turtleLinear != null) { turtleLinear.OnDead(false); } else if (turtleBlinder != null) { turtleBlinder.OnDead(false); } else if (turtleBoom != null) { turtleBoom.OnDead(false); } else if (turtleConfuser != null) { turtleConfuser.OnDead(false); } else if (turtleSpear != null) { turtleSpear.OnDead(false); } else if (turtleSuddenAttack != null) { turtleSuddenAttack.OnDead(false); } else if (turtleSummoner != null) { turtleSummoner.OnDead(false); } else if (turtleSummons != null) { turtleSummons.OnDead(false); } } else if (obj.CompareTag("Dragon")) { Dragon dragon = obj.GetComponent <Dragon>(); if (dragon != null) { dragon.OnDead(); } } else if (obj.CompareTag("Swirl")) { obj.SetActive(false); } else if (obj.CompareTag("Item")) { Item item = obj.GetComponent <Item>(); if (item != null) { item.EndingDestroyItem(); } } else if (obj.CompareTag("Soul")) { Soul soul = obj.GetComponent <Soul>(); if (soul != null) { soul.EndingDestroySoul(); } } } } StartCoroutine(UISide()); endingAni.SetTrigger("Ending"); }