IEnumerator Moving(float second) { yield return(new WaitForSeconds(0.25f)); move.MoveToRoom(roomToMoveX, roomToMoveY); yield return(new WaitForSeconds(1.5f)); DoorOpen(); EraseObject(); KeyDrop(); yield return(new WaitForSeconds(second)); move.MoveToRoom(currentRoomX, currentRoomY); yield return(new WaitForSeconds(1f)); PlayerControl.g_playerCanMove = true; PlayerControl.g_waitForCamera = false; }
IEnumerator FadeScreen() { while (canvas.alpha < 1) { Debug.Log("Fade"); canvas.alpha = 1; //canvas.alpha += Time.deltaTime; } move.MoveToRoom(nextRoomX, nextRoomY); player.transform.position = newPos; yield return(new WaitForSeconds(0.5f)); while (canvas.alpha > 0) { player.gameObject.GetComponent <Animator>().Play("Indle_Tree"); Debug.Log("FadeOut"); canvas.alpha -= Time.deltaTime; yield return(null); } player.gameObject.GetComponent <Rigidbody2D>().isKinematic = false; PlayerControl.g_playerCanMove = true; player.gameObject.GetComponent <Rigidbody2D>().mass = 1f; }