Пример #1
0
    private CurseStr DoMana(string speechWord)
    {
        // get speech from speechManager
        //string speechWord = "BLINK";
        CurseStr curseStr    = CurseStr.Flame;
        int      currentMana = mana_bar.GetCurrentAmout();

        if ("Flame".Equals(speechWord))
        {
            //current mana
            if (currentMana <= 40)
            {
                curseStr = CurseStr.VALID;
                return(curseStr);
            }
            curseStr = CurseStr.Flame;
            mana_bar_obj.SetActive(true);
            mana_bar.ChangeManaCir(40);
            incendio_ps.SetActive(true);
            StartCoroutine(SetManaDisper(incendio_ps));
        }
        else if ("Flare".Equals(speechWord))
        {
            if (currentMana <= 80)
            {
                curseStr = CurseStr.VALID;
                return(curseStr);
            }
            curseStr = CurseStr.Flare;
            //lightTrans_obj.gameObject.SetActive (true);
            mana_bar_obj.SetActive(true);
            mana_bar.ChangeManaCir(80);
            lightTrans.StartBlink();
            //StartCoroutine (SetManaDisper(lightTrans_obj));
        }
        else if ("Flash".Equals(speechWord))
        {
            //current mana
            if (currentMana <= 60)
            {
                curseStr = CurseStr.VALID;
                return(curseStr);
            }
            curseStr = CurseStr.Flash;
            mana_bar_obj.gameObject.SetActive(true);
            mana_bar.ChangeManaCir(60);
            flash_ps.SetActive(true);
            StartCoroutine(SetManaDisper(flash_ps, 3));
        }
        else
        {
            curseStr = CurseStr.NONE;
        }
        return(curseStr);
    }
Пример #2
0
 void Attack(CurseStr curentStr)
 {
     if (snake != null && snake.GetIsGazeIn() == true)
     {
         snake.GetDamage(GetRightDamageByCurse(curentStr));
     }
     else if (fox != null && fox.GetIsGazeIn() == true)
     {
         if (fox.state == Fox.State.WALK)
         {
             fox.GetDamage(GetRightDamageByCurse(curentStr));
         }
     }
     else if ("Spider".Equals(""))
     {
         //spider.GetDamage(GetRightDamageByCurse(curentStr));
     }
 }
Пример #3
0
    private int GetRightDamageByCurse(CurseStr curentStr)
    {
        int rtnDamage = 0;

        switch (curentStr)
        {
        case CurseStr.Flame:
            rtnDamage = 30;
            break;

        case CurseStr.Flash:
            rtnDamage = 40;
            break;

        default:
            rtnDamage = 0;
            break;
        }
        return(rtnDamage);
    }
Пример #4
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;
            }
        }
    }