void OnTriggerStay(Collider coll) { // Check if player has completed the level, and is in the area // Find all pencils GameObject[] pickups = GameObject.FindGameObjectsWithTag("Pick-Up"); if (coll.gameObject.tag == "Player" && pickups.Length == 0 && Input.GetKey(KeyCode.E) && isActive == false) { isActive = true; // Set it so it can only be called once Debug.Log(" -- FB_Intro - Dialog -- "); Debug.Log(" -- Play audio -- "); Camera.main.GetComponent <CameraController>().PlayAudio(Audio); StartCoroutine(printDialog(Dialog)); } else if (Input.GetKey(KeyCode.E) && isActive == false) { Debug.Log(" -- FB_Intro - Dialog -- "); UI.PrintDialog("De leraar wilt je werk nog niet nakijken", 1); } }
//Check if the player enters the elevator void OnTriggerStay(Collider col) { if (col.gameObject.tag == "Player" && Elevator == true && Input.GetKey(KeyCode.E) && DoorOpen) { DoorOpen = false; UI.Show_Curtain(); Debug.Log("De deur gaat magisch open"); isLoadingNextLevel = true; StartCoroutine(coLoadLevel(levelNaam, 1.5f)); } else if (col.gameObject.tag == "Player" && Input.GetKey(KeyCode.E) && isLoadingNextLevel == false) { Debug.Log("De deur zit nog dicht"); UI.PrintDialog("De deur zit nog dicht!", 2); } }