Exemplo n.º 1
0
    // Starts loggingGame.
    public void StartLogging()
    {
        logStart = Time.time;

        if (logGame)
        {
            jGameLog      = new JsonGameLog(testID);
            gameLogLength = JsonUtility.ToJson(jGameLog).Length;

            loggingGame = true;
        }

        if (logStatistics)
        {
            jStatisticsLog      = new JsonStatisticsLog(testID);
            statisticsLogLength = JsonUtility.ToJson(jStatisticsLog).Length + 200;

            lastTargetLog         = 0;
            currentDistance       = 0;
            totalDistance         = 0;
            shotCount             = 0;
            hitCount              = 0;
            killCount             = 0;
            lastPosition          = new Vector3(-1, -1, -1);
            initialTargetPosition = new Vector3(-1, -1, -1);
            initialPlayerPosition = new Vector3(-1, -1, -1);

            loggingStatistics = true;
        }

        foreach (MonoBehaviour monoBehaviour in FindObjectsOfType(typeof(MonoBehaviour)))
        {
            ILoggable logger = monoBehaviour as ILoggable;
            if (logger != null)
            {
                logger.SetupLogging();
            }
        }
    }