Beispiel #1
0
    public void ToggleMenu()
    {
        if (gameObject.activeSelf)
        {
            // Check if button is tapped
            RaycastHit hit;
            if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit))
            {
                MenuButton button = hit.transform.gameObject.GetComponent <MenuButton>();
                if (button != null && button.Active)
                {
                    bool close = true;
                    switch (button.Data.Type)
                    {
                    case ButtonType.Back:
                        StartCoroutine(MenuReplace(0));
                        close = false;
                        break;

                    case ButtonType.Register:
                        Microphone.registeringNewUser = true;
                        break;

                    case ButtonType.Navigation:
                        StartCoroutine(MenuReplace(button.Data.Destination));
                        close = false;
                        break;

                    case ButtonType.Reply:
                        Chatroom.AddMessage("Me", button.Data.Message);
                        TextSpeech.SpeakText(button.Data.Message);
                        break;
                    }

                    if (close)
                    {
                        StartCoroutine(MenuDisappear());
                    }
                }
            }
        }
        else
        {
            // Set menu position to directly in front of user
            transform.position = Camera.main.transform.position + Camera.main.transform.forward * 5;

            Chatroom.Disappear();
        }
    }
Beispiel #2
0
    public void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            HoverMenu.ToggleMenu();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            string text = "Test message: ";
            for (int i = 0; i < Random.Range(100, 200); i++)
            {
                text += "a ";
            }
            Chatroom.AddMessage("Guy", text);
        }
    }
Beispiel #3
0
 private void ProcessUserIdentification(string name, string text)
 {
     chatroomManager.AddMessage(name, text);
 }