public override IEnumerator LoadScenes([ValueSource(nameof(GetHelloWorldScene))] string scenePath)
    {
        // Log warnings instead of creating dialog boxes if authentication fails
        if (m_suppressDialogs)
        {
            PlayerPrefs.SetInt("Havok.Auth.SuppressDialogs", 1);
        }
        else
        {
            PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
        }

        // Ensure Havok
        var world  = World.DefaultGameObjectInjectionWorld;
        var system = world.GetOrCreateSystem <EnsureHavokSystem>();

        EnsureHavokSystem.EnsureHavok(system);

        SceneManager.LoadScene(scenePath);
        yield return(new WaitForSeconds(1));

        UnityPhysicsSamplesTest.ResetDefaultWorld();
        yield return(new WaitForFixedUpdate());

        LogAssert.NoUnexpectedReceived();
        m_NumTestsRun++;

        PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
    }
Пример #2
0
    private IEnumerator SetupAndLoadScene(World world, HavokConfiguration havokConfig, string scenePath)
    {
        var system = world.GetOrCreateSystem <EnsureHavokSystem>();

        system.Enabled = true;
        system.EntityManager.CreateEntity(new ComponentType[] { typeof(HavokConfiguration) });
        system.SetSingleton <HavokConfiguration>(havokConfig);

        SceneManager.LoadScene(scenePath);
        yield return(new WaitForSeconds(1));

        UnityPhysicsSamplesTest.ResetDefaultWorld();
        yield return(new WaitForFixedUpdate());
    }
        public override IEnumerator LoadScenes([ValueSource(nameof(UnityPhysicsSamplesTest.GetScenes))] string scenePath)
        {
            // Don't create log messages about the number of trial days remaining
            PlayerPrefs.SetInt("Havok.Auth.SuppressDialogs", 1);

            // Log scene name in case Unity crashes and test results aren't written out.
            Debug.Log("Loading " + scenePath);
            LogAssert.Expect(LogType.Log, "Loading " + scenePath);

            SceneManager.sceneLoaded += (Scene scene, LoadSceneMode mode) => SetSimulationType(SimulationType.HavokPhysics, scene, mode);
            SceneManager.LoadScene(scenePath);
            yield return(new WaitForSeconds(1));

            UnityPhysicsSamplesTest.EntitiesCleanup();
            yield return(new WaitForFixedUpdate());

            LogAssert.NoUnexpectedReceived();

            PlayerPrefs.DeleteKey("Havok.Auth.SuppressDialogs");
        }