void Awake()
 {
     if (mainRAE == null)
     {
         mainRAE = this;
     }
     else
     {
         Debug.LogError("More than 1 RAE!");
         Destroy(this);
     }
     Logger.Instance.Enabled = false;
     DontDestroyOnLoad(this);
     DontDestroyOnLoad(this.gameObject);
 }
Exemple #2
0
        void Start()
        {
            raeComponents = new List <RAEComponent>();
            raeComponents.Add(null);
            raeComponents.AddRange(GetComponents <RAEComponent>().OrderBy(comp => comp.GUIOrder));
            rae = GetComponent <ReplayAnalysisEngine>();
            //writer = GetComponent<AnalysisWriter>();
            optionNames = (from comp in raeComponents select comp == null ? "Replay" : comp.GUIName).ToArray <string>();
            reader      = GetComponent <Agent>();

            gameWidth  = float.IsNaN(gameWidth) ? Screen.height * Camera.main.aspect : gameWidth;
            originX    = (Screen.width - gameWidth) / 2f;
            gameHeight = float.IsNaN(gameHeight) ? Screen.height : gameHeight;

            if (float.IsNaN(windowWidth) || float.IsNaN(windowHeight))
            {
                windowWidth  = gameWidth * 3 / 4;
                windowHeight = gameWidth * 3 / 4;
            }
            mainWindowRect = new Rect(gameWidth / 8, gameHeight / 8, windowWidth, windowHeight);
            debugGUIRect   = new Rect(0, 0, windowWidth, gameHeight);
        }
Exemple #3
0
        public override void OnInspectorGUI()
        {
            ReplayAnalysisEngine rae = target as ReplayAnalysisEngine;

            EditorGUILayout.BeginVertical();

            Application.targetFrameRate = EditorGUILayout.IntField("Target FrameRate", Application.targetFrameRate);
            Application.runInBackground = EditorGUILayout.Toggle("Run In Background", Application.runInBackground);

            //rae.ReplayMode = (ReplayAnalysisEngine.IterationMode)EditorGUILayout.EnumPopup("Iteration Mode", rae.ReplayMode);

            rae.stopCondition = (ReplayAnalysisEngine.StoppingCondition)EditorGUILayout.EnumPopup("Stopping Condition", rae.stopCondition);

            switch (rae.stopCondition)
            {
            case ReplayAnalysisEngine.StoppingCondition.Instant:
                break;

            case ReplayAnalysisEngine.StoppingCondition.WaitForStop:
            case ReplayAnalysisEngine.StoppingCondition.TimeOut:
            case ReplayAnalysisEngine.StoppingCondition.Custom:
            case ReplayAnalysisEngine.StoppingCondition.Simulate:
                rae.TimeAcceleration = EditorGUILayout.FloatField("Time Acceleration", rae.TimeAcceleration);
                rae.TimeOut          = EditorGUILayout.FloatField("Time Out", rae.TimeOut);
                break;
            }

            rae.ScreenShotTiming = (ReplayAnalysisEngine.ScreenShotTimingOption)EditorGUILayout.EnumPopup("Screenshot Timing", rae.screenshotTiming);

            if (rae.screenshotTiming != ReplayAnalysisEngine.ScreenShotTimingOption.Disabled)
            {
                rae.screenShotMode      = (ReplayAnalysisEngine.ScreenShotModeOption)EditorGUILayout.EnumPopup("Screenshot Mode", rae.screenShotMode);
                rae.screenshotDirectory = EditorGUILayout.TextField("Screenshot Directory", rae.screenshotDirectory);
            }

            bool before = rae.PauseAfter > 0;

            bool check = EditorGUILayout.Toggle("Pause", rae.PauseAfter > 0);

            if (before != check)
            {
                if (before)
                {
                    rae.PauseAfter = -1;
                }
                else
                {
                    rae.PauseAfter = lastPause;
                }
            }

            if (rae.PauseAfter > 0)
            {
                lastPause = EditorGUILayout.IntField("Pause After Every", (int)rae.PauseAfter);
                if (lastPause < 1)
                {
                    lastPause = 1;
                }
                rae.PauseAfter = lastPause;
            }

            rae.runReportPath = EditorGUILayout.TextField("Report Path", rae.runReportPath);

            rae.heavyDebug = EditorGUILayout.Toggle("Heavy Debug", rae.heavyDebug);

            EditorGUILayout.EndVertical();

            if (GUI.changed)
            {
                EditorUtility.SetDirty(rae);
            }
        }