Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (GamePlayManager._instance.GetIsOver())
        {
            if (death != null && !death.isPlaying)
            {
                death.Play();
            }
            can.SetActive(true);
            textSpeech.Length = 0;
            speechPanel.text  = textSpeech.Append(" 死亡!\n(ヒント:頭の部分を狙う)...").ToString();
            //StartCoroutine(SetManaDisper (can));
            return;
        }
        MonsterDown();

                #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.X))
        {
            isAct = true;
        }
        else
        {
            isAct = false;
        }
                #endif
                #if UNITY_ANDROID && !UNITY_EDITOR
        if (GvrController.ClickButtonDown == true)
        {
            isAct = true;
        }
        else
        {
            isAct = false;
        }
                #endif
                #if UNITY_EDITOR
        if (isAct)
        {
            isCanDo = true;
        }
                #endif
                #if UNITY_ANDROID && !UNITY_EDITOR
        if (isAct)
        {
            speechStr = "";
            isCanDo   = true;
            //StartCoroutine (BeginSpeech ());
            SpeechManager._instance.StartSpeech();
        }
        speechStr = SpeechManager._instance.GetCurse();
                #endif
        //jineng tiao
        //Mana Bar Show or Not
        if (mana_bar.GetCurrentAmout() >= 100)
        {
            mana_bar_obj.SetActive(false);
        }
        //2017/06/20 PC test
        //speechStr = "Flash";
        if (isCanDo == false)
        {
            return;
        }
        if ("".Equals(speechStr))
        {
            speechStr = SpeechManager._instance.GetCurse();
        }
        else
        {
            if (!"NULL".Equals(speechStr) && !"Begin".Equals(speechStr) &&
                !"End".Equals(speechStr) && !"Error".Equals(speechStr) && !"Start".Equals(speechStr))
            {
                CurseStr curentStr = DoMana(speechStr);
                if (curentStr == CurseStr.NONE)
                {
                    //UI表示2s後消し
                    can.SetActive(true);
                    textSpeech.Length = 0;
                    textSpeech        = textSpeech.Append("登録されない呪文: ")
                                        .Append(speechStr);
                    speechPanel.text = textSpeech.ToString();
                    isCanDo          = false;
                    StartCoroutine(SetManaDisper(can));
                }
                else if (curentStr == CurseStr.VALID)
                {
                    //MP不足
                    //UI表示2s後消し
                    can.SetActive(true);
                    textSpeech.Length = 0;
                    speechPanel.text  = textSpeech.Append("MP不足\n補充中です!").ToString();
                    isCanDo           = false;
                    //StartCoroutine (SetManaDisper (can));
                }
                else
                {
                    if ((snake != null && snake.GetIsGazeIn() == true) ||
                        (fox != null && fox.GetIsGazeIn() == true))
                    {
                        Attack(curentStr);
                    }
                    isCanDo = false;
                    //StartCoroutine (SetManaDisper (can));
                }
                //isCanDo = false;
            }
            else if (!"Error".Equals(speechStr))
            {
                //can not get word
                can.SetActive(true);
                textSpeech.Length = 0;
                textSpeech        = textSpeech.Append("声を入力してください!")
                                    .Append(speechStr);
                speechPanel.text = textSpeech.ToString();
                StartCoroutine(SetManaDisper(can));
                //isCanDo = false;
            }
//			else if("Begin".Equals (speechStr)){
//				//can not get word
//				can.SetActive (true);
//				textSpeech.Length = 0;
//				textSpeech = textSpeech.Append ("声を入力してください");
//				speechPanel.text = textSpeech.ToString ();
//				//StartCoroutine (SetManaDisper (can));
//				//isCanDo = false;
//			}
//			else if ("Error".Equals (speechStr)) {
//				//can not get word
//				can.SetActive (true);
//				textSpeech.Length = 0;
//				textSpeech = textSpeech.Append ("タイムアウト");
//				speechPanel.text = textSpeech.ToString ();
//				StartCoroutine (SetManaDisper (can));
//				isCanDo = false;
//			}
            else if ("Start".Equals(speechStr))
            {
                //can not get word
                can.SetActive(true);
                textSpeech.Length = 0;
                textSpeech        = textSpeech.Append("認識準備中");
                speechPanel.text  = textSpeech.ToString();
                //StartCoroutine (SetManaDisper (can));
                //isCanDo = false;
            }
        }
    }