Beispiel #1
0
    private IEnumerator runTest(TestData pData)
    {
        log("Preparing new text...", "yellow");

        TestData testData = new TestData(pData);

        _objectSpawner.CleanObjects();

        yield return(new WaitForSeconds(1));

        yield return(new WaitUntil(() => _objectSpawner.GenerateObjectGrid(testData.gridSize, testData.type))); // Generate object grid

        testData.trisCount = _objectSpawner.GetTrisCount();

        yield return(new WaitForSeconds(5)); // Give it some extra time to load

        log("Next test: " + testData.testDescription, "yellow");

        // Recording test
        _performanceLogger.StartRecording();
        yield return(new WaitForSeconds(testData.testDurationSeconds));

        _performanceLogger.StopRecording();

        // Save test results
        testData.frameData = _performanceLogger.getFpsLog();
        _testResults.Add(testData);

        RunNextTest();
    }
    public void TriggerSceneChange(SceneManager sceneManager, string levelName, int spawnPointID)
    {
        if (objectSpawner)
        {
            objectSpawner.CleanObjects();
            Destroy(objectSpawner);
        }
        //Load the scene manager if one is defined
        if (sceneManager != null)
        {
            nextLevel = new SceneManagerInstance(sceneManager);
        }
        //Fix sorting layer and order
        GetComponent <SpriteRenderer>().sortingLayerName = DefaultSortingLayer;
        GetComponent <SpriteRenderer>().sortingOrder     = DefaultSortingOrder;
        NumberOfSpritesBehind = 0;
        //Get spawning position
        string newLevel = levelName;

        _targetSpawnID = spawnPointID;
        //Load level
        Application.LoadLevel(newLevel);
        //Notify event system that location has changed
        GetComponent <EventManager>().Event(new List <object>()
        {
            GameAction.IN_AREA, newLevel
        });
        //Save all this to the database
        networkManager.DBSwitchInstance();
        networkManager.UpdatePlayerStat("CurrentScene", levelName);
        networkManager.UpdatePlayerStat("CurrentSceneSpawn", spawnPointID.ToString());
        if (sceneManager != null && sceneManager.name != null)
        {
            networkManager.UpdatePlayerStat("CurrentSceneManager", sceneManager.name);
        }
        else
        {
            networkManager.UpdatePlayerStat("CurrentSceneManager", "");
        }
    }