Exemple #1
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 250, 1000, 1000));

        GUI.Box(new Rect(0, 0, 500, 450), "EasyTTS Demo");
        stringToEdit = GUI.TextField(new Rect(30, 30, 440, 200), stringToEdit, 600);
        if (GUI.Button(new Rect(30, 230, 440, 40), "Speak"))
        {
            EasyTTSUtil.SpeechAdd(stringToEdit);
        }
        else if (GUI.Button(new Rect(30, 270, 440, 40), "Repeat"))
        {
            EasyTTSUtil.SpeechFlush(stringToEdit);
        }
        else if (GUI.Button(new Rect(30, 310, 440, 40), "Stop"))
        {
            EasyTTSUtil.StopSpeech();
        }
        else if (GUI.Button(new Rect(30, 350, 440, 40), "Clear"))
        {
            stringToEdit = "";
        }
        GUI.Label(new Rect(30, 400, 440, 100), "Stop and Repeat button only works once build on mobile iOS or Android ");

        GUI.EndGroup();
    }
Exemple #2
0
    /*
     * When avatar come into contact with a TRIGGER
     * such as the destination cube.
     * @param col - the trigger that was collided
     */
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.CompareTag("target"))
        {
            infoBrg = new NextDirection();
            //TheInformationBridge();
            infoBrg.setEndTime(timerText.text);
            infoBrg.setNumOfCollisions(countColli);

            EasyTTSUtil.SpeechFlush("Congratulations, you've reached your destination.");
            Debug.Log("Game Over, you've completed the course");

            Invoke("changeToEndGameScene", 4);             // Wait 4 seconds and then call the "changeToEndScene" Method.
        }

        if (col.gameObject.tag == "Door")
        {
            Debug.Log("Walking through room " + col.gameObject.name + " door");
            EasyTTSUtil.SpeechAdd("Walking through room " + col.gameObject.name + " door");
        }
    }
Exemple #3
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 250, 1100, 1000));
        GUI.Box(new Rect(0, 0, 500, 450), "EasyTTS Demo");
        stringToEdit = GUI.TextField(new Rect(30, 20, 440, 160), stringToEdit, 600);

        volume = GUI.HorizontalSlider(new Rect(90, 200, 300, 20), volume, 0.01f, 1);
        GUI.Label(new Rect(40, 195, 300, 40), "Volume");
        GUI.Label(new Rect(400, 195, 300, 40), volume + "%");

        pitch = GUI.HorizontalSlider(new Rect(90, 225, 300, 20), pitch, 0.5f, 2);
        GUI.Label(new Rect(40, 222, 300, 40), "Pitch");
        GUI.Label(new Rect(400, 222, 300, 40), pitch + "%");


        rate = GUI.HorizontalSlider(new Rect(90, 250, 300, 20), rate, 0.01f, 1);
        GUI.Label(new Rect(40, 245, 300, 40), "Rate");
        GUI.Label(new Rect(400, 245, 300, 40), rate + "%");

        if (GUI.Button(new Rect(30, 275, 440, 40), "Speak"))
        {
            EasyTTSUtil.SpeechAdd(stringToEdit, volume, rate, pitch);
        }
        else if (GUI.Button(new Rect(30, 320, 440, 40), "Repeat"))
        {
            EasyTTSUtil.SpeechFlush(stringToEdit, volume, rate, pitch);
        }
        else if (GUI.Button(new Rect(30, 365, 440, 40), "Stop"))
        {
            EasyTTSUtil.StopSpeech();
        }
        else if (GUI.Button(new Rect(30, 410, 440, 40), "Clear"))
        {
            stringToEdit = "";
        }

        GUI.Label(new Rect(30, 460, 440, 100), "Stop and Repeat button only works once build on mobile iOS or Android ");

        GUI.EndGroup();
    }
Exemple #4
0
    void Update()
    {
        if (Input.touchCount > 0)
        {
            foreach (Touch touch in Input.touches)
            {
                switch (touch.phase)
                {
                case TouchPhase.Began:
                    /* this is a new touch */
                    isSwipe         = true;
                    fingerStartTime = Time.time;
                    fingerStartPos  = touch.position;
                    break;

                case TouchPhase.Canceled:
                    /* The touch is being canceled */
                    isSwipe = false;
                    break;

                case TouchPhase.Ended:

                    float gestureTime = Time.time - fingerStartTime;
                    float gestureDist = (touch.position - fingerStartPos).magnitude;

                    if (isSwipe && gestureTime < maxSwipeTime && gestureDist > minSwipeDist)
                    {
                        Vector2 direction = touch.position - fingerStartPos;
                        Vector2 swipeType = Vector2.zero;

                        if (Mathf.Abs(direction.x) > Mathf.Abs(direction.y))
                        {
                            // the swipe is horizontal:
                            swipeType = Vector2.right * Mathf.Sign(direction.x);
                        }
                        else
                        {
                            // the swipe is vertical:
                            swipeType = Vector2.up * Mathf.Sign(direction.y);
                        }

                        if (swipeType.x != 0.0f)
                        {
                            if (swipeType.x > 0.0f || Input.GetKey("right"))
                            {
                                // MOVE RIGHT
                                Debug.Log("MoveRight");
                                EasyTTSUtil.SpeechFlush("You chose a harder route");
                                if (Register.gameMode == 1)
                                {
                                    Register.startPoint = new Vector3(80f, 2f, -53.6f);
                                    Register.endPoint   = new Vector3(-23f, 2f, 173f);
                                    Application.LoadLevel("CCNYGrove");
                                }
                                else
                                {
                                    Register.startPoint = new Vector3(80f, 2f, -53.6f);
                                    Register.endPoint   = new Vector3(-23f, 2f, 173f);
                                    Application.LoadLevel("CCNYGroveTest");
                                }
                            }
                            else if (swipeType.x < 0.0f || Input.GetKey("left"))
                            {
                                // MOVE LEFT
                                Debug.Log("MoveLeft");
                                EasyTTSUtil.SpeechFlush("You chose a harder route");
                                if (Register.gameMode == 1)
                                {
                                    Register.startPoint = new Vector3(80f, 2f, -53.6f);
                                    Register.endPoint   = new Vector3(-23f, 2f, 173f);
                                    Application.LoadLevel("CCNYGrove");
                                }
                                else                                                                                                            // game mode == 2 && mode == 1
                                {
                                    Register.startPoint = new Vector3(80f, 2f, -53.6f);
                                    Register.endPoint   = new Vector3(-23f, 2f, 173f);
                                    Application.LoadLevel("CCNYGroveTest");
                                }
                            }
                        }

                        if (swipeType.y != 0.0f)
                        {
                            if (swipeType.y > 0.0f || Input.GetKey("up"))
                            {
                                // MOVE UP
                                EasyTTSUtil.SpeechFlush("You chose a simple route");
                                if (Register.gameMode == 1)
                                {
                                    startP = new Vector3(104f, 2f, -103f);
                                    endP   = new Vector3(-51f, 2f, -88f);
                                    Application.LoadLevel("CCNYGrove");
                                }
                                else
                                {
                                    startP = new Vector3(104f, 2f, -103f);
                                    endP   = new Vector3(-51f, 2f, -88f);
                                    Application.LoadLevel("CCNYGroveTest");
                                }
                            }
                            else if (swipeType.y < 0.0f || Input.GetKey("down"))
                            {
                                // MOVE DOWN
                                EasyTTSUtil.SpeechFlush("You chose a normal route");
                                if (Register.gameMode == 1)
                                {
                                    startP = new Vector3(161f, 2f, -140f);
                                    endP   = new Vector3(18f, 2f, -7f);
                                    Application.LoadLevel("CCNYGrove");
                                }
                                else
                                {
                                    startP = new Vector3(161f, 2f, -140f);
                                    endP   = new Vector3(18f, 2f, -7f);
                                    Application.LoadLevel("CCNYGroveTest");
                                }
                            }
                        }
                    }
                    break;
                }
            }
        }
        //TryHand();

        /*
         * if (floorPick() == 1)
         * {
         * Debug.Log ("Firstfloor array selected");
         * rooms = new string[] { "Grand Hall" };
         *
         * }
         *
         * if (floorPick() == 2)
         * {
         * Debug.Log ("second floor array selected");
         * rooms = new string[] { "Gaslamp A",
         *                 "Gaslamp B",
         *                 "Gaslamp C",
         *                 "Gaslamp D",
         *                 "La Jolla A",
         *                 "La Jolla B",
         *                 "Old Town A",
         *                 "Old Town B",
         *                 "Balbora A",
         *                 "Balbora B",
         *                 "Balbora C"
         *               };
         *
         * }
         * if (floorPick() == 3)
         * {
         * Debug.Log ("third floor array selected");
         * rooms = new string[] { "Torrey Hills A",
         *                 "Torrey Hills B",
         *                 "Golden Hill A",
         *                 "Golden Hill B",
         *
         *                 "HillCrest A",
         *                 "HillCrest B",
         *                 "HillCrest C",
         *                 "HillCrest D",
         *                 "Cortez A",
         *                 "Cortez B",
         *                 "Cortez C",
         *
         *                 "Bankers Hill",
         *                 "Mission Beach A",
         *                 "Mission Beach B",
         *                 "Mission Beach C",
         *                 "Solana Beach A",
         *
         *                 "Solana Beach B",
         *                 "Ocean Beach",
         *                 "Promenade A",
         *                 "Promenade B",
         *                 "Pier",
         *                 "Cove"
         *               };
         *
         * }
         */
    }
Exemple #5
0
    /*public void ChangeSliderValue (Slider slider)
     * {
     *      slider.maxValue = rooms.Length;
     *      for (int i = 0; i < rooms.Length; i++)
     *      {
     *
     *              if ((int)slider.value == i)
     *              {
     *                      choice = rooms[ (int)slider.value];
     *                      room_text.text = "Room: " + rooms[ (int)slider.value];
     *                      Debug.Log (rooms[ (int)slider.value]);
     *                      EasyTTSUtil.SpeechFlush (rooms[ (int)slider.value]);
     *              }
     *      }
     * }*/

    void introToCurrentMenu()
    {
        EasyTTSUtil.SpeechFlush("To select a path that you want to learn," +
                                "you can swipe updown or left and right.");
    }
Exemple #6
0
 public static void Speak(string text)
 {
     EasyTTSUtil.SpeechFlush(text + ".", volume: 1, rate: 0.4f, pitch: 0.6f);
 }
Exemple #7
0
    /*public void ChangeSliderValue (Slider slider)
     * {
     *      slider.maxValue = rooms.Length;
     *      for (int i = 0; i < rooms.Length; i++)
     *      {
     *
     *              if ((int)slider.value == i)
     *              {
     *                      choice = rooms[ (int)slider.value];
     *                      room_text.text = "Room: " + rooms[ (int)slider.value];
     *                      Debug.Log (rooms[ (int)slider.value]);
     *                      EasyTTSUtil.SpeechFlush (rooms[ (int)slider.value]);
     *              }
     *      }
     * }*/

    void introToCurrentMenu()
    {
        EasyTTSUtil.SpeechFlush("To select a room from a list of choices, slide your thumb on the left" +
                                "side of the screen up or down");
        EasyTTSUtil.SpeechAdd("To finalize your choice. With your thumb, double tap the right side of the screen");
    }