예제 #1
0
    void Update()
    {
        if (Input.GetMouseButton(0) && currentAmount < 100)
        {
            currentAmount += speed * Time.deltaTime;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            currentAmount = 0;
        }

        if (currentAmount >= 100)
        {
            sceneManager.ChangeScene();
            if (particleBurst != null)
            {
                particleBurst.SetActive(true);
            }

            if (buttonObj != null)
            {
                buttonObj.GetComponent <Animator>().enabled = true;
            }
        }

        loadingBar.GetComponent <Image>().fillAmount = currentAmount / 100;
    }
예제 #2
0
    private void GrammarRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
    {
        SemanticMeaning[] meanings = args.semanticMeanings;

        List <string> parameters = new List <string>();
        String        action     = "";

        foreach (SemanticMeaning meaning in meanings)
        {
            // Debug.Log($"meaning {meaning.key}, {meaning.values[0]}");
            if (meaning.key == "Action")
            {
                action = meaning.values[0];
            }
            else if (meaning.key == "Parameters")
            {
                parameters.AddRange(meaning.values);
            }
        }

        if (debug)
        {
            String partsString = String.Join(", ", parameters.ToArray());

            StringBuilder builder = new StringBuilder();
            builder.AppendFormat("{0}{1}", args.text, Environment.NewLine);
            builder.AppendFormat("Confidence: {0}\tDuration: {1}{2}", args.confidence, args.phraseDuration.TotalSeconds, Environment.NewLine);
            builder.AppendFormat("Action: {0}\tParts: {1}{2}", action, partsString, Environment.NewLine);
            Debug.Log(builder.ToString());
        }

        if (action == "show")
        {
            //setModelActive(parameters, false);
            _speechText.text = "Show " + parameters[0];
            GameObject avatar = getWholeBody().parent.gameObject;
            avatar.GetComponent <NetworkRenderManager>().setModelActive(parameters, true);
            //Debug.Log("NI found " + getWholeBody().transform.parent.gameObject.GetComponent<NetworkIdentity>().ToString());
        }
        else if (action == "hide")
        {
            _speechText.text = "Hide " + parameters[0];
            GameObject avatar = getWholeBody().parent.gameObject;
            //avatar.GetComponent<NetworkRenderManager>().RpcDisableSkin();
            avatar.GetComponent <NetworkRenderManager>().setModelActive(parameters, false);
            //setModelActive(parameters, false);
            //Debug.Log("NI found " + getWholeBody().transform.parent.gameObject.GetComponent<NetworkIdentity>().ToString());
        }
        //else if (action == "connect")
        //{
        //    _speechText.text = "Connect";
        //    Connect2Server();
        //}
        //else if (action == "disconnect")
        //{
        //    _speechText.text = "Disconnect";
        //    DisconnectServer();
        //}
        else if (action == "host session")
        {
            _speechText.text = "Host session";
            HostSession();
        }
        else if (action == "change parent")
        {
            Transform avatar = getWholeBody().parent.transform;
            avatar.parent = avatar.parent == Camera.main.transform ? null : Camera.main.transform;
        }
        else if (action == "next pose")
        {
            Transform wholeBody = getWholeBody();
            wholeBody.parent.transform.Find("IKTargets").GetComponent <MockTargets>().ChangePose();
        }
        else if (action == "calibrate")
        {
            _speechText.text = "Calibrate";
            _calibMark.CalibrateSpace();
        }
        else if (action == "calibration done")
        {
            _speechText.text = "Calibration done";
            _calibMark.CalibrationDone();
        }
        else if (action == "toggle display")
        {
            _speechText.text = "Toggle Display";
            bool dispState = _displayPanel.activeSelf ? false : true;
            _displayPanel.SetActive(dispState);
        }
        else if (action == "study lung")
        {
            _errorText.text = "";
            _bodyText.gameObject.SetActive(false);
            _lungText.gameObject.SetActive(true);
            _speechText.text = "Study Lung";
            GameObject avatar = getWholeBody().parent.gameObject;
            _sceneManager.ChangeScene(avatar, _lung);
        }
        else if (action == "study heart")
        {
            if (!getLung())
            {
                _errorText.text = "Study lung first";
                return;
            }
            _errorText.text = "";
            _lungText.gameObject.SetActive(false);
            _heartText.gameObject.SetActive(true);
            _speechText.text = "Study Heart";
            _sceneManager.ChangeScene(getLung().gameObject, _heart);
        }
        else if (action == "almost done")
        {
            if (!getHeart())
            {
                _errorText.text = "Study heart first";
                return;
            }
            _errorText.text = "";
            _displayPanel.SetActive(false);
            _sceneManager.ChangeScene(getHeart().gameObject, _shark);
        }
    }
예제 #3
0
 /// <summary>
 /// Calls the loadScene method from the scene manager.
 /// </summary>
 /// <param name="sceneName"></param>
 public void ChangeScene(string sceneName)
 {
     ManageScenes.ChangeScene(sceneName);
 }
예제 #4
0
 public void ChangeScene()
 {
     _sceneManager.ChangeScene(_lung, _heart);
 }
 void LoseGame()
 {
     ManageScenes.ChangeScene("LoseScene");
 }
 void WinGame()
 {
     ManageScenes.ChangeScene("WinScene");
 }