예제 #1
0
    // Use this for initialization
    void Start()
    {
        recorder        = gameObject.GetComponent <FlashbackRecorder>();
        inputController = GameObject.Find("IOController").GetComponent <InputController>();
        eventManager    = GameObject.Find("BehaviorController").GetComponent <EventManager>();
        objSelector     = GameObject.Find("VoxWorld").GetComponent <ObjectSelector>();
        commBridge      = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
        preds           = GameObject.Find("BehaviorController").GetComponent <Predicates>();

        refExpGenerator = GameObject.Find("ReferringExpressionGenerator")
                          .GetComponent <ReferringExpressionGenerator>();

        captureVideo   = (PlayerPrefs.GetInt("Capture Video") == 1);
        captureParams  = (PlayerPrefs.GetInt("Capture Params") == 1);
        captureMode    = (VideoCaptureMode)PlayerPrefs.GetInt("Video Capture Mode");
        filenameScheme = (VideoCaptureFilenameType)PlayerPrefs.GetInt("Video Capture Filename Type");
        sortByEvent    = (PlayerPrefs.GetInt("Sort By Event String") == 1);
        filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
        dbFile         = PlayerPrefs.GetString("Video Capture DB");
        videoDir       = PlayerPrefs.GetString("Video Output Directory");

        if ((!captureVideo) && (!captureParams))
        {
            return;
        }

        if (videoDir != string.Empty)
        {
            recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
        }

        if (captureMode == VideoCaptureMode.PerEvent)
        {
            refExpGenerator.ItemsSituated += StartCaptureProcess;

            intervalWaitTimer          = new Timer(intervalWaitTime);
            intervalWaitTimer.Enabled  = false;
            intervalWaitTimer.Elapsed += WaitComplete;

            eventTimeoutTimer          = new Timer(eventTimeoutTime);
            eventTimeoutTimer.Enabled  = false;
            eventTimeoutTimer.Elapsed += StopCapture;

            FileWritten += CaptureComplete;
        }
    }
	// Use this for initialization
	void Start() {
		recorder = gameObject.GetComponent<FlashbackRecorder>();
		inputController = GameObject.Find("IOController").GetComponent<InputController>();
		eventManager = GameObject.Find("BehaviorController").GetComponent<EventManager>();
		objSelector = GameObject.Find("VoxWorld").GetComponent<ObjectSelector>();
		commBridge = GameObject.Find("CommunicationsBridge").GetComponent<CommunicationsBridge>();
		preds = GameObject.Find("BehaviorController").GetComponent<Predicates>();

		captureVideo = (PlayerPrefs.GetInt("Capture Video") == 1);
		captureParams = (PlayerPrefs.GetInt("Capture Params") == 1);
		captureMode = (VideoCaptureMode) PlayerPrefs.GetInt("Video Capture Mode");
		resetScene = (PlayerPrefs.GetInt("Reset Between Events") == 1);
		eventResetCounter = PlayerPrefs.GetInt("Event Reset Counter");
		filenameScheme = (VideoCaptureFilenameType) PlayerPrefs.GetInt("Video Capture Filename Type");
		sortByEvent = (PlayerPrefs.GetInt("Sort By Event String") == 1);
		filenamePrefix = PlayerPrefs.GetString("Custom Video Filename Prefix");
		dbFile = PlayerPrefs.GetString("Video Capture DB");
		inputFile = PlayerPrefs.GetString("Auto Events List");
		eventIndex = PlayerPrefs.GetInt("Start Index");
		videoDir = PlayerPrefs.GetString("Video Output Directory");

		if ((!captureVideo) && (!captureParams)) {
			return;
		}

		if (videoDir != string.Empty) {
			recorder.SetOutputDirectory(Path.GetFullPath(Application.dataPath + videoDir));
		}

		InitObjectDisabling();

		eventObjs = new List<GameObject>();

		if (captureMode == VideoCaptureMode.PerEvent) {
            // TODO: Default Listener Port no longer active, switch to Commander
			commBridge.PortOpened += StartAutoInput;

			inputController.InputReceived += PrepareScene;
			inputController.InputReceived += InputStringReceived;
			inputController.ParseComplete += ParseReceived;

			eventManager.ObjectsResolved += ObjectsResolved;
			eventManager.ObjectsResolved += FilterSpecifiedManner;
			eventManager.ObjectsResolved += EnableAffectedObjects;
			eventManager.ObjectsResolved += InsertWaitPeriod;
			//eventManager.ObjectsResolved += StartCapture;
			eventManager.SatisfactionCalculated += SatisfactionCalculated;
			eventManager.SatisfactionCalculated += EnableAffectedObjects;
			eventManager.SatisfactionCalculated += InsertWaitPeriod;
			//eventManager.SatisfactionCalculated += StartCapture;
			//eventManager.ExecuteEvent += EnableAffectedObjects;
			//eventManager.EventInserted += EventInserted;
			eventManager.ExecuteEvent += StartCapture;
			eventManager.QueueEmpty += EventComplete;

			preds.waitTimer.Elapsed += WaitComplete;
			preds.PrepareLog += PrepareLog;
			preds.ParamsCalculated += ParametersCalculated;

			eventTimeoutTimer = new Timer(eventTimeoutTime);
			eventTimeoutTimer.Enabled = false;
			eventTimeoutTimer.Elapsed += EventTimedOut;
			eventTimeoutTimer.Elapsed += StopCapture;

			eventCompleteWaitTimer = new Timer(eventCompleteWaitTime);
			eventCompleteWaitTimer.Enabled = false;
			eventCompleteWaitTimer.Elapsed += StopCapture;

			FileWritten += CaptureComplete;
		}
	}