IEnumerator PerformRitual() { GameObject sacrifice = MetaScript.GetSacrificialNPC(); // Disable and heal player setPlayerBusy(true); health = maxHealth; // Sacrifice failed if (sacrifice == null) { // Load other scene Destroy(gameObject); gameEnds(); } else { // Stop npc from moving; sacrifice.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = false; sacrifice.GetComponent <collect>().enabled = false; sacrifice.GetComponent <Guard>().enabled = false; sacrifice.GetComponent <follow>().enabled = false; // Teleport player; MetaScript.preTeleport(); sacrifice.transform.eulerAngles = new Vector3(45, 0, 90); transform.position = sacrifice.transform.position; sacrifice.transform.position = sacrifice.transform.position + new Vector3(0.25f, 0, 0); // TODO: Delay spawn // Destroy npc yield return(new WaitForSeconds(2.0f)); sacrifice.GetComponent <Health>().death(); MetaScript.postTeleport(); setPlayerBusy(false); } yield return(null); }