Beispiel #1
0
    private void DebugText(string str1)
    {
        KotodamaPos(str1);
        textObject      = FlyingText.GetObjects(str1, PlayerPos, Quaternion.identity);//FlyingTextを生成
        textObject.name = str1;
        Rigidbody rigidbody = textObject.AddComponent <Rigidbody>();

        Rigidbody[] rigidbodies = textObject.GetComponentsInChildren <Rigidbody>();
        textObject.transform.Rotate(CameraAngleX, CameraAngleY + angle, 0);//PlayerControllerのY.rotateを参照
        foreach (var TextChild in rigidbodies)
        {
            TextChild.useGravity = false;
            TextChild.AddForce(textObject.transform.forward * bulletSpeed, ForceMode.Impulse);
            TextChild.tag = "flyingText";
        }
        //textObject.tag = "flyingText";
        Destroy(textObject, 10.0f);
    }
    IEnumerator Start()
    {
        RenderSettings.fog            = true;
        RenderSettings.fogColor       = Camera.main.backgroundColor;
        RenderSettings.fogMode        = FogMode.Linear;
        RenderSettings.fogEndDistance = 20.0f;

        while (true)
        {
            var gameOverText = FlyingText.GetObjects("GAME<br>OVER").transform;
            var pos          = gameOverText.position;
            pos.z = -6.5f;
            gameOverText.position = pos;
            var rigidbodies = gameOverText.GetComponentsInChildren <Rigidbody>();
            foreach (var rb in rigidbodies)
            {
                rb.useGravity = false;
            }

            for (float i = 0.0f; i < 1.0f; i += Time.deltaTime)
            {
                pos   = gameOverText.position;
                pos.y = Mathf.Lerp(5.0f, -.05f, i);
                gameOverText.position = pos;
                yield return(null);
            }
            StartCoroutine(CameraShake(Camera.main));

            yield return(new WaitForSeconds(1.75f));

            Instantiate(explosion, new Vector3(0.0f, 1.0f, -6.3f), Quaternion.identity);
            foreach (var rb in rigidbodies)
            {
                rb.useGravity = true;
                rb.AddExplosionForce(220.0f, new Vector3(0, 1, -6.5f), 10.0f, 9.0f);
            }

            yield return(new WaitForSeconds(5.0f));

            Destroy(gameOverText.gameObject);
            yield return(new WaitForSeconds(1.0f));
        }
    }
Beispiel #3
0
    public void BossKotodama2(string str1, Vector3 pos1, float bulletnum, float Angle)
    {
        //enemytext = FlyingText.GetObjects(str1, pos1, Quaternion.identity);//FlyingTextを生成
        enemytext      = FlyingText.GetObjects(str1, redMaterial, null, 10.0f, 2.0f, 5, pos1, Quaternion.identity);//FlyingTextを生成
        enemytext.name = "EnemyText";
        Rigidbody rigidbody = enemytext.AddComponent <Rigidbody>();

        Rigidbody[] rigidbodies = enemytext.GetComponentsInChildren <Rigidbody>();
        enemytext.transform.Rotate(-12, Angle, 0);//PlayerControllerのY.rotateを参照
        foreach (var TextChild in rigidbodies)
        {
            TextChild.useGravity = false;
            TextChild.AddForce(enemytext.transform.forward * bulletnum, ForceMode.Impulse);
            TextChild.tag = "EnemyText";

            //TextChild.gameObject.AddComponent<EnemyflyingText>();
        }
        enemytext.tag = "EnemyText";
        //enemytext.AddComponent<EnemyflyingText>();
        Destroy(enemytext, 10.0f);
    }
Beispiel #4
0
    void Update()
    {
        //if (!MenuUI.activeSelf)
        //{

        if (Input.GetMouseButton(0))
        {
            if (dictationRecognizer.Status != SpeechSystemStatus.Running)
            {
                //ディクテーションを開始
                dictationRecognizer.Start();
                //Debug.Log("音声認識開始");
                //ホールドアニメーション再生
                animVoiceInput = GameObject.Find("VoiceInput").gameObject.GetComponent <Animator>();
                animVoiceInput.SetBool("MouseHold", true);

                /*if (Time.timeScale==1.0f)
                 * {
                 * Time.timeScale = SlowTime;
                 * }*/
            }
        }
        if (dictationRecognizer.Status == SpeechSystemStatus.Running)
        {
            dictationRecognizer.DictationResult += DictationRecognizer_DictationResult;         //DictationRecognizer_DictationResult処理を行う

            dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis; //DictationRecognizer_DictationHypothesis処理を行う

            dictationRecognizer.DictationComplete += DictationRecognizer_DictationComplete;     //DictationRecognizer_DictationComplete処理を行う

            dictationRecognizer.DictationError += DictationRecognizer_DictationError;           //DictationRecognizer_DictationError処理を行う

            if (inputText != testText)
            {
                KotodamaPos(inputText);
                audio.PlayOneShot(ATKClip, 1.0f);
                textObject      = FlyingText.GetObjects(inputText, PlayerPos, Quaternion.identity); //FlyingTextを生成
                textObject.name = inputText;
                textObject.transform.Rotate(CameraAngleX, CameraAngleY + angle, 0);                 //PlayerControllerのY.rotateを参照
                Rigidbody   rigidbody   = textObject.AddComponent <Rigidbody>();
                Rigidbody[] rigidbodies = textObject.GetComponentsInChildren <Rigidbody>();

                foreach (var TextChild in rigidbodies)
                {
                    TextChild.useGravity = false;
                    TextChild.AddForce(textObject.transform.forward * bulletSpeed, ForceMode.Impulse);
                    TextChild.tag = "flyingText";
                }
                //textObject.tag = "flyingText";
                Destroy(textObject, 10.0f);
            }
            inputText = testText;
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (dictationRecognizer.Status != SpeechSystemStatus.Stopped)
            {
                //Debug.Log("音声認識終了");
                dictationRecognizer.Stop();
                animVoiceInput.SetBool("MouseHold", false);

                /*if (Time.timeScale == SlowTime)
                 * {
                 *  Time.timeScale = 1.0f;
                 * }*/
            }
        }
        //}

        // イベントにイベントハンドラーを追加
        SceneManager.sceneLoaded += SceneLoaded;

        if (debugKotodama == true)
        {
            if (Input.GetKeyDown(KeyCode.Q))
            {
                DebugText(DebugText1);
            }
            if (Input.GetKeyDown(KeyCode.E))
            {
                DebugText(DebugText2);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                DebugText(DebugText3);
            }
        }
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        nowString = WSVoiceRecognition.GetGiveS();

        if (currentString != nowString)
        {
            //取得したテキストからマテリアルを決定
            Material mat = DefaultMat;
            if (Regex.IsMatch(nowString, @"赤"))
            {
                mat = RedMat;
            }
            if (Regex.IsMatch(nowString, @"青"))
            {
                mat = BlueMat;
            }
            if (Regex.IsMatch(nowString, @"黄"))
            {
                mat = YellowMat;
            }
            if (Regex.IsMatch(nowString, @"緑"))
            {
                mat = GreenMat;
            }
            if (Regex.IsMatch(nowString, @"ピンク"))
            {
                mat = PinkMat;
            }
            if (Regex.IsMatch(nowString, @"オレンジ"))
            {
                mat = OrangeMat;
            }
            if (Regex.IsMatch(nowString, @"灰"))
            {
                mat = GrayMat;
            }
            if (Regex.IsMatch(nowString, @"紫"))
            {
                mat = PurpleMat;
            }
            //テキストの生成位置
            Vector3 random = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f), 0);

            //テキストオブジェクトの生成
            textObject = FlyingText.GetObjects(nowString, mat, mat, 1.0f, 0.25f, 1, random, Quaternion.identity);

            //物理演算の設定(RigidBody)
            var rigidbodies = textObject.GetComponentsInChildren <Rigidbody>();
            foreach (var rb in rigidbodies)
            {
                Vector3 vel = new Vector3(0, 0, 10f);
                rb.velocity   = vel;
                rb.useGravity = false;
            }

            //削除時間の設定
            Destroy(textObject, 4.0f);

            //多重処理防止
            currentString = nowString;
        }
    }
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            if (dictationRecognizer.Status != SpeechSystemStatus.Running)
            {
                //ディクテーションを開始
                dictationRecognizer.Start();
                //Debug.Log("音声認識開始");

                animVoiceInput.SetBool("MouseHold", true);
            }
        }
        if (dictationRecognizer.Status == SpeechSystemStatus.Running)
        {
            dictationRecognizer.DictationResult += DictationRecognizer_DictationResult;         //DictationRecognizer_DictationResult処理を行う

            dictationRecognizer.DictationHypothesis += DictationRecognizer_DictationHypothesis; //DictationRecognizer_DictationHypothesis処理を行う

            dictationRecognizer.DictationComplete += DictationRecognizer_DictationComplete;     //DictationRecognizer_DictationComplete処理を行う

            dictationRecognizer.DictationError += DictationRecognizer_DictationError;           //DictationRecognizer_DictationError処理を行う

            if (inputText != testText)
            {
                KotodamaPos(inputText);

                textObject      = FlyingText.GetObjects(inputText, CameraPos, Quaternion.identity); //FlyingTextを生成
                textObject.name = inputText;
                textObject.transform.Rotate(CameraAngleX, CameraAngleY + angle, 0);                 //PlayerControllerのY.rotateを参照
                Rigidbody   rigidbody   = textObject.AddComponent <Rigidbody>();
                Rigidbody[] rigidbodies = textObject.GetComponentsInChildren <Rigidbody>();

                foreach (var TextChild in rigidbodies)
                {
                    TextChild.useGravity = false;
                    TextChild.AddForce(textObject.transform.forward * bulletSpeed, ForceMode.Impulse);
                    TextChild.tag = "flyingText";
                }
                Destroy(textObject, 10.0f);

                inputText = testText;
                CriAtomSource atomSrc = gameObject.GetComponent <CriAtomSource>();
                if (atomSrc != null)
                {
                    atomSrc.Play(9);
                }

                /* if (inputText == "スタート" || inputText == "すたーと")
                 * {
                 *
                 *   fade.isFadeOut = true;
                 *   Invoke(nameof(FadeWait), 5.0f);
                 *   Debug.Log("ゲームスタート");
                 * }*/
            }
            inputText = testText;
        }

        if (Input.GetMouseButtonUp(0))
        {
            if (dictationRecognizer.Status != SpeechSystemStatus.Stopped)
            {
                // Debug.Log("音声認識終了");
                dictationRecognizer.Stop();
                animVoiceInput.SetBool("MouseHold", false);
            }
        }

        // イベントにイベントハンドラーを追加
        SceneManager.sceneLoaded += SceneLoaded;
    }