Exemple #1
0
    void Awake()
    {
        // on awake initialize clicker, spatial mapping material and other things
        clickerManager        = GetComponent <ClickerManager>();
        ClickSwitch           = false;
        logPosRot             = mainCamera.GetComponent <LogPosRot>();
        mappingMaterial       = spatialMapping.GetComponent <SpatialMappingManager>();
        objectSurfaceObserver = spatialMapping.GetComponent <ObjectSurfaceObserver>();
        var meshmanager = GetComponent <MeshManager>();

        // App always starts off
        mappingMaterial.DrawVisualMeshes = false;
    }
Exemple #2
0
    /// <summary>
    /// Initializes the voice placement functionality - get a reference to the Spatial
    /// Mapping Manager and set up the keyword recognizer
    /// </summary>
    void Start()
    {
        // Get Spatial Mapping Manager so we can access it's shared material later
        Player          = GameObject.Find("SpatialMapping");
        mappingMaterial = Player.GetComponent <SpatialMappingManager>();

        // set current VoiceCommand to "Listening"
        Camera       = GameObject.Find("Main Camera");
        eventManager = Camera.GetComponent <LogPosRot>();

        MainMenu = GameObject.Find("MainMenu");

        eventManager.tempEvent = "Listening";
        print(eventManager.tempEvent);

        Experiment = GameObject.Find("Experiment");



        // Setup a keyword recognizer to enable resetting the target location.
        List <string> keywords = new List <string>();

        // Keywords to select between different shaders
        keywords.Add("Set Shader Normal");
        keywords.Add("Set Shader Depth");
        keywords.Add("Set Shader Wireframe");

        keywords.Add("Adjust HoloLens");

        // Keywords to turn the shaders on and off
        keywords.Add("Shader Off");
        keywords.Add("Shader On");

        // Keywords to adjust the depth map shader equation
        keywords.Add("Depth Map Standard");
        keywords.Add("Depth Map Inverted");
        keywords.Add("Depth Map Scaled");
        keywords.Add("Depth Map Non Linear");
        keywords.Add("Depth Map Color 4");
        keywords.Add("Depth Map Color 5");
        keywords.Add("Depth Map Color 6");
        keywords.Add("Depth Map Red to Blue continuous"); // color map from Red to Blue in 6 steps
        keywords.Add("Depth Map Red to Blue six");        // color map from Red to Blue in 6 steps
        keywords.Add("Depth Map Red to Blue five");       // color map from Red to Blue in 5 steps
        keywords.Add("Depth Map Yellow to Blue six");     // Yellow to Blue
        keywords.Add("Depth Map Yellow to Blue five");
        keywords.Add("Depth Map Yellow to Red six");      // Yellow to Red
        keywords.Add("Depth Map Yellow to Red five");
        keywords.Add("Depth Map Flicker");
        keywords.Add("Depth Map Dynamic");
        keywords.Add("Depth Map Discrete");
        keywords.Add("Depth Map Pulse");
        keywords.Add("Test Pulse");

        // Keywords to adjust the depth map shader color
        keywords.Add("Set Color White");
        keywords.Add("Set Color Red");
        keywords.Add("Set Color Green");
        keywords.Add("Set Color Blue");
        keywords.Add("Set Color Yellow");
        keywords.Add("Set Color Orange");
        keywords.Add("Set Color Purple");
        keywords.Add("Set Color Grey");

        // Keywords for experiment cycle
        keywords.Add("Begin Training");
        keywords.Add("Begin Trial");
        keywords.Add("Found Chair");
        keywords.Add("End Trial");

        // Initialize keyword recognizer
        keywordRecognizer = new KeywordRecognizer(keywords.ToArray());
        keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
        keywordRecognizer.Start();

        // App always starts off
        mappingMaterial.DrawVisualMeshes = false;
    }
    void Start()
    {
        /// begin experiment loop

        // set trial stage
        trialStage = "initializing";
        trialStage = "wait_for_input"; // remove this later

        // Play start instructions
        instrSwitch = 1;
        PlayInstructions();

        // set current VoiceCommand to "Listening"
        Camera                 = GameObject.Find("Main Camera");
        eventManager           = Camera.GetComponent <LogPosRot>();
        eventManager.tempEvent = "Start";


        print(eventManager.tempEvent);
        StartCoroutine(wait1());


        if (trialStage == "go_to_practiceRoom")
        {
            StartCoroutine(wait2());
            print("wait2 over; going to wait_for_input");
        }

        else if (trialStage == "wait_for_input")
        {
            print("waiting for user input");
        }
        else if (trialStage == "begin_practice")
        {
            StartCoroutine(wait3());
            print("wait3 over; going to practice");
        }
        else if (trialStage == "practice")
        {
            StartCoroutine(waitPractice());
        }
        else if (trialStage == "practice_over")
        {
            StopCoroutine(waitPractice());
            print("Practice is over. The time is " + DateTime.Now.ToString("HH:mm:ss"));

            trialStage = "prepare_task_chair";
        }
        else if (trialStage == "prepare_task_chair")
        {
            // give instructions to go to next room and say "Begin trial" whenever ready
            // sit idle and wait for user input: "Begin trial
        }
        else if (trialStage == "begin_task_chair")
        {
            /// pick shader and layout according to selection
            /// then go to task
            trialStage = "task_chair";
        }
        else if (trialStage == "task_chair")
        {
            // sit idle and wait for user input: "Found chair"
        }
        else if (trialStage == "end_task_chair")
        {
            /// give instructions to get up and explore for two minutes
            /// wait for voice command for exploring
        }
        else if (trialStage == "task_exploring")
        {
            // sit idle and wait two minutes
        }
        else if (trialStage == "end_task_chair")
        {
            /// give instructions to find experimenter
            /// close app
        }
    }