Пример #1
0
    // Run the sequence of steps associated with changing rooms.
    private IEnumerator changeRooms()
    {
        RoomProperties.persistRoom(SceneManager.GetActiveScene().name);

        // Start the door opening sound playing.
        if (doorOpenSound != null)
        {
            doorOpenSound.Play();
        }
        // Start the door opening animation.
        Animator animator = GetComponent <Animator>();

        // Yield until the door is fully open.
        while (!animator.GetBool("DoorIsOpen"))
        {
            yield return(new WaitForSeconds(0.1f));
        }
        animator.SetBool("OpenDoor", false);

        // Transfer any objects that need to go to the next scene.
//     if (book != null)
//     {
//       DontDestroyOnLoad (book);
//     }

        changeToRoom(destinationRoom, this);
//     SceneManager.sceneLoaded += OnSceneLoaded;
//     // Change scenes.
//     AsyncOperation asyncLoad = SceneManager.LoadSceneAsync (destinationRoom, LoadSceneMode.Single);
//
//     while (!asyncLoad.isDone)
//     {
//       yield return null;
//     }
    }
Пример #2
0
    IEnumerator persistRoom(float delay)
    {
        while (true)
        {
            yield return(new WaitForSeconds(delay));

            Debug.Log("Persisting");
            RoomProperties.persistRoom(SceneManager.GetActiveScene().name);
        }
    }