Ejemplo n.º 1
0
    void RemoveMarker(GameObject marker)
    {
        MarkedItems markedItems = markedItemObject.GetComponent <MarkedItems>();

        if (markedItems.gameObjectList.Contains(marker) &&
            marker.GetComponent <ItemInfo>().createdTime < Time.time - 2)
        {
            markedItems.gameObjectList.Remove(marker);
            Destroy(marker);
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     // Grab the mesh renderer that's on the same object as this script.
     meshRenderer          = this.gameObject.GetComponentInChildren <MeshRenderer>();
     markedItems           = GameObject.Find("MarkedItems");
     soundPlayer           = GameObject.Find("SoundPlayer");
     userModeManager       = GameObject.Find("UserModeManager");
     userModeManagerScript = userModeManager.GetComponent <UserModeManager>();
     soundPlayerScript     = soundPlayer.GetComponent <SoundPlayer>();
     markedItemsScript     = markedItems.GetComponent <MarkedItems>();
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        createdTime           = Time.time;
        markedItems           = GameObject.Find("MarkedItems");
        userModeManager       = GameObject.Find("UserModeManager");
        markedItemsScript     = markedItems.GetComponent <MarkedItems>();
        userModeManagerScript = FindObjectOfType <UserModeManager>();

        ttsManager  = FindObjectOfType <TextToSpeechManager>();
        soundPlayer = FindObjectOfType <SoundPlayer>();

        itemAudioSource = gameObject.GetComponent <AudioSource>();
        // itemAudioSource.clip = Resources.Load<AudioClip>("table");
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        string[] outCommands = { "table",  "laptop", "floor",     "ceiling", "television",
                                 "person", "wall",   "cup",       "chair",   "refrigerator",
                                 "switch", "clock",  "microwave", "soda",    "gaggle" };
        commands = outCommands;

        userModeManagerScript = userModeManager.GetComponent <UserModeManager>();


        keywords.Add("Reset world", () =>
        {
            // Call the OnReset method on every descendant object.
            this.BroadcastMessage("OnReset");
        });

        keywords.Add("Drop Sphere", () =>
        {
            var focusObject = GazeGestureManager.Instance.FocusedObject;
            if (focusObject != null)
            {
                // Call the OnDrop method on just the focused object.
                focusObject.SendMessage("OnDrop");
            }
        });

        keywords.Add("learn", () =>
        {
            userModeManagerScript.setUserMode("learn");
        });

        keywords.Add("teach", () =>
        {
            userModeManagerScript.setUserMode("teach");
        });

        GameObject markedItems = GameObject.Find("MarkedItems");

        foreach (string command in commands)
        {
            keywords.Add(command, () =>
            {
                // Do a raycast into the world based on the user's
                // head position and orientation.
                var headPosition  = Camera.main.transform.position;
                var gazeDirection = Camera.main.transform.forward;

                RaycastHit hitInfo;
                if (Physics.Raycast(headPosition, gazeDirection, out hitInfo))
                {
                    //
                    var position = hitInfo.point;

                    //GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);

                    //GUI drag
                    GameObject cube = Instantiate(itemPreFab);

                    cube.transform.position   = position;
                    cube.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
                    var iteminfo      = cube.GetComponent <ItemInfo>();
                    iteminfo.Title    = command;
                    iteminfo.ItemName = command;
                    cube.name         = command;

                    iteminfo.markedItems = markedItems;
                    //iteminfo.userModeManager = userModeManager;
                    iteminfo.userModeManagerScript = userModeManagerScript;

                    //as long as assing somethign has a type.
                    //var itemAudioSource = cube.GetComponent<AudioSource>();
                    //itemAudioSource.clip = Resources.Load<AudioClip>(command);
                    if (items == null)
                    {
                        items = markedItems.GetComponent <MarkedItems>();
                    }
                    items.gameObjectList.Add(cube);
                }
            });
        }
        ;



        // Tell the KeywordRecognizer about our keywords.
        keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray());

        // Register a callback for the KeywordRecognizer and start recognizing!
        keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized;
        keywordRecognizer.Start();
    }
Ejemplo n.º 5
0
 public void Start()
 {
     markedItemsScript     = FindObjectOfType <MarkedItems>();
     userModeManagerScript = FindObjectOfType <UserModeManager>();
 }