Exemple #1
0
        public void Start()
        {
            Scope = ProfileManager.Instance.currentEvaluationScope;
            SetVariables();

            var visualizationTextureIndex = 0;
            var visualizationIndex        = 0;

            actualVisualization = 0;

            radiusAlphaVisualizationList = new List <Tuple <float, float> > {
                Tuple.New(0.0f, 0.0f)
            };

            movingSphere = false;
            movingPlane  = false;

            csvCreator = new CsvCreator(csvCreatorPath);
            csvCreator.AddLines("TEST", ("Use Vortices: " + (!bgiiesMode).ToString() + " -- UseBgiies: " + bgiiesMode.ToString() + " -- Use LeapMotion: " + useLeapMotion.ToString() + "-- Use Pitch Grab: " + usePitchGrab.ToString() + " -- Use OpenGlove: " + useHapticGlove.ToString() + " -- Use Joystick: " + useJoystick.ToString() + " -- Use Mouse: " + mouseInput.ToString() + " -- Use Kinect: " + kinectInput.ToString()));

            var leapSpaceChildrens = leapMotionRig.leapSpace.transform.GetChildren();

            foreach (var leapSpacechildren in leapSpaceChildrens)
            {
                leapSpacechildren.gameObject.SetActive(useLeapMotion);
            }

            if (autoTuneVisualizationOnPlay)
            {
                if (visualizationPlane)
                {
                    AutoTunePlanes();
                }
                else
                {
                    AutoTuneSpheres();
                }
            }
            if (visualizationPlane)
            {
                foreach (var planeController in planeControllers)
                {
                    planeController.InitializeDioControllers(this, visualizationIndex, transform.position, visualizationTextureIndex, true);
                    radiusAlphaVisualizationList.Add(Tuple.New(planeController.distance, planeController.alpha));

                    visualizationTextureIndex += planeController.elementsToDisplay;
                    visualizationIndex        += 1;
                }
            }
            else
            {
                foreach (var sphereController in sphereControllers)
                {
                    sphereController.InitializeDioControllers(this, visualizationIndex, transform.position, visualizationTextureIndex, true);
                    radiusAlphaVisualizationList.Add(Tuple.New(sphereController.sphereRadius, sphereController.alpha));

                    visualizationTextureIndex += sphereController.elementsToDisplay;
                    visualizationIndex        += 1;
                }
            }

            if (bgiiesMode)
            {
                if (lookPointerBgiiesPrefab != null)
                {
                    var lookPointerPosition = new Vector3(0.0f, 0.0f, radiusAlphaVisualizationList[1].First);
                    lookPointerInstanceBgiies = Instantiate(lookPointerBgiiesPrefab, leapMotionRig.centerEyeAnchor, lookPointerPosition, Quaternion.identity);
                    lookPointerInstanceBgiies.transform.localScale = lookPointerScale;

                    lookPointerInstanceBgiies.Initialize(this);
                }
            }
            else
            {
                if (lookPointerPrefab != null && !(useKeyboard && useMouse))
                {
                    var lookPointerPosition = new Vector3(0.0f, 0.0f, radiusAlphaVisualizationList[1].First);
                    lookPointerInstance = Instantiate(lookPointerPrefab, leapMotionRig.centerEyeAnchor, lookPointerPosition, Quaternion.identity);
                    lookPointerInstance.transform.localScale = lookPointerScale;

                    lookPointerInstance.Initialize(this);
                }
            }

            rayCastingDetector.Initialize(this);

            if (bgiiesMode)
            {
                buttonPanel.gameObject.SetActive(false);
                panelBgiies.Initialize(this);
                if (kinectInput)
                {
                    bodySrcManager.gameObject.SetActive(true);
                    kinectGestures.gameObject.SetActive(true);
                    kinectGestures.Initialize(this);

                    kinectFace.gameObject.SetActive(true);
                    kinectFace.Initialize(this);

                    kinectGestureManager.gameObject.SetActive(true);
                    kinectGestureManager.Initialize(this);
                }
            }
            else
            {
                panelBgiies.gameObject.SetActive(false);
                buttonPanel.Initialize(this);
            }
            loadImageController.Initialize(this);
            loadingScene.Initialize(this);

            //unityOpenGlove.Initialize(this);
            if (useHapticGlove)
            {
                unityHapticGlove.gameObject.SetActive(true);
                unityHapticGlove.Initialize(this);
            }

            if (!bgiiesMode)
            {
                if (useLeapMotion)
                {
                    buttonPanel.transform.parent = leapMotionRig.centerEyeAnchor.transform;

                    var buttonPanelPosition = buttonPanel.transform.position;
                    buttonPanelPosition.z          = 0.4f;
                    buttonPanel.transform.position = new Vector3(buttonPanelPosition.x, buttonPanelPosition.y, buttonPanelPosition.z);

                    if (!usePitchGrab)
                    {
                        buttonPanel.zoomOut3DButton.gameObject.SetActive(false);
                    }
                }
                buttonPanel.zoomIn3DButton.gameObject.SetActive(false);
            }

            if (bgiiesMode)
            {
                StartCoroutine(loadImageController.LoadFolderImages(planeControllers.SelectMany(sc => sc.dioControllerList).ToList()));
            }
            else
            {
                StartCoroutine(loadImageController.LoadFolderImages(sphereControllers.SelectMany(sc => sc.dioControllerList).ToList()));
            }


            initialSphereAction = () =>
            {
                buttonPanel.DisableZoomIn();
                buttonPanel.DisableZoomOut();
                buttonPanel.DisableAccept();
                buttonPanel.DisableMoveCameraInside();
                buttonPanel.DisableMoveCameraOutside();
            };

            finalSphereAction = () =>
            {
                buttonPanel.EnableMoveCameraInside();
                buttonPanel.EnableMoveCameraOutside();
            };

            initialPlaneAction = () =>
            {
                panelBgiies.DisableMoveCameraInside();
                panelBgiies.DisableMoveCameraOutside();
            };

            finalPlaneAction = () =>
            {
                panelBgiies.EnableMoveCameraInside();
                panelBgiies.EnableMoveCameraOutside();
            };

            ActionManager.Instance.InitializeManager(this);
            EEGManager.Instance.CheckInterfaces();
            EyetrackerManager.Instance.InitializeManager(this);
        }
Exemple #2
0
        public void Start()
        {
            SetVariables();
            var visualizationTextureIndex = 0;
            var visualizationIndex        = 0;

            actualVisualization          = 0;
            radiusAlphaVisualizationList = new List <Tuple <float, float> > {
                Tuple.New(0.0f, 0.0f)
            };

            movingSphere = false;
            movingPlane  = false;

            csvCreator = new CsvCreator(csvCreatorPath);

            var leapSpaceChildrens = leapMotionRig.leapSpace.transform.GetChildren();

            foreach (var leapSpacechildren in leapSpaceChildrens)
            {
                leapSpacechildren.gameObject.SetActive(useLeapMotion);
            }

            if (autoTuneVisualizationOnPlay)
            {
                if (visualizationPlane)
                {
                    AutoTunePlanes();
                }
                else
                {
                    AutoTuneSpheres();
                }
            }
            if (visualizationPlane)
            {
                foreach (var planeController in planeControllers)
                {
                    planeController.InitializeDioControllers(this, visualizationIndex, transform.position, visualizationTextureIndex, true);
                    radiusAlphaVisualizationList.Add(Tuple.New(planeController.distance, planeController.alpha));

                    visualizationTextureIndex += planeController.elementsToDisplay;
                    visualizationIndex        += 1;
                }
            }
            else
            {
                foreach (var sphereController in sphereControllers)
                {
                    sphereController.InitializeDioControllers(this, visualizationIndex, transform.position, visualizationTextureIndex, true);
                    radiusAlphaVisualizationList.Add(Tuple.New(sphereController.sphereRadius, sphereController.alpha));

                    visualizationTextureIndex += sphereController.elementsToDisplay;
                    visualizationIndex        += 1;
                }
            }

            if (lookPointerPrefab != null && !(useKeyboard && useMouse))
            {
                var lookPointerPosition = new Vector3(0.0f, 0.0f, radiusAlphaVisualizationList[1].First);
                lookPointerInstance = Instantiate(lookPointerPrefab, leapMotionRig.centerEyeAnchor, lookPointerPosition, Quaternion.identity);
                lookPointerInstance.transform.localScale = lookPointerScale;

                lookPointerInstance.Initialize(this);
            }

            rayCastingDetector.Initialize(this);

            if (mouseInput && !useKeyboard && !useJoystick)
            {
                panelMouse.Initialize(this);
                buttonPanel.gameObject.SetActive(false);
            }
            else
            {
                buttonPanel.Initialize(this);
                panelMouse.gameObject.SetActive(false);
            }

            //loadImageController.Initialize(this);
            loadingScene.Initialize(this);

            unityOpenGlove.Initialize(this);

            if (useLeapMotion)
            {
                buttonPanel.transform.parent = leapMotionRig.centerEyeAnchor.transform;

                var buttonPanelPosition = buttonPanel.transform.position;
                buttonPanelPosition.z          = 0.4f;
                buttonPanel.transform.position = new Vector3(buttonPanelPosition.x, buttonPanelPosition.y, buttonPanelPosition.z);

                if (!usePitchGrab)
                {
                    buttonPanel.zoomOut3DButton.gameObject.SetActive(false);
                }
            }
            if (!mouseInput)
            {
                buttonPanel.zoomIn3DButton.gameObject.SetActive(false);
            }

            StartCoroutine(loadImageController.LoadFolderImages());

            initialSphereAction = () =>
            {
                buttonPanel.DisableZoomIn();
                buttonPanel.DisableZoomOut();
                buttonPanel.DisableAccept();
                buttonPanel.DisableMoveCameraInside();
                buttonPanel.DisableMoveCameraOutside();
            };

            finalSphereAction = () =>
            {
                buttonPanel.EnableMoveCameraInside();
                buttonPanel.EnableMoveCameraOutside();
            };

            if (mouseInput && !useKeyboard && !useJoystick)
            {
                initialPlaneAction = () =>
                {
                    panelMouse.DisableMoveCameraInside();
                    panelMouse.DisableMoveCameraOutside();
                };

                finalPlaneAction = () =>
                {
                    panelMouse.EnableMoveCameraInside();
                    panelMouse.EnableMoveCameraOutside();
                };
            }
            else
            {
                initialPlaneAction = () =>
                {
                    buttonPanel.DisableZoomIn();
                    buttonPanel.DisableZoomOut();
                    buttonPanel.DisableAccept();
                    buttonPanel.DisableMoveCameraInside();
                    buttonPanel.DisableMoveCameraOutside();
                };

                finalPlaneAction = () =>
                {
                    buttonPanel.EnableMoveCameraInside();
                    buttonPanel.EnableMoveCameraOutside();
                };
            }
        }