Example #1
0
    void OnSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        string lastScene = m_data.LastScene;

        if (lastScene != null)
        {
            Debug.Log("Last scene was:" + lastScene);
        }
        else
        {
            Debug.Log("No last scene. Should only see this message once on game load");
        }

        //TODO: There needs to be a cleaner way to remove/toggle lighting in the hubworld.
        //		It may be more accessible to move this logic to a Light Controller?
        //		Also, obviously this needs to be looped.  Temporary for demo purposes.
        if (scene.name == "HubWorld")
        {
            //check lights and remove them according to game progress
            GameObject l0 = GameObject.Find("/ground0/Lantern");
            GameProgress.HubWorldDoorStatus l0s = m_progress.GetDoorState(0);
            if (l0s != GameProgress.HubWorldDoorStatus.completed)
            {
                Destroy(l0);
            }

            GameObject l1 = GameObject.Find("/ground1/Lantern");
            GameProgress.HubWorldDoorStatus l1s = m_progress.GetDoorState(1);
            if (l1s != GameProgress.HubWorldDoorStatus.completed)
            {
                Destroy(l1);
            }
        }
    }