Пример #1
0
    private void OnTriggerStay(Collider other)
    {
        if (LayerMask.LayerToName(gameObject.layer) == "Damage")
        {
            return;
        }



        if (other.tag != "Boundary" && (other.tag == "Enemy" || other.tag == "Enemy_Bullet"))
        {
            Debug.Log(player_current_hp);
            player_current_hp -= 1;

            if (player_current_hp <= 1.1f && player_current_hp >= 0.9f)
            {
                SE3.Play();
            }

            hpSlider.value = player_current_hp; //Valueの値をPyHPの値にする



            if (player_current_hp <= 0)
            {
                Instantiate(explosion, transform.position, transform.rotation);


                GameObject[] child = GameObject.FindGameObjectsWithTag("Child");
                for (int i = 0; i < child.Length; i++)
                {
                    Instantiate(explosion, child[i].transform.position, child[i].transform.rotation);
                    Destroy(child[i].gameObject);
                }

                //switch (Parameter.STAGE)
                //   {
                //      case 1:
                //         GameObject.FindWithTag("GameController").GetComponent<GameController_Stage1>().gameover();
                //        break;
                //   default:
                GameObject.FindWithTag("GameController").GetComponent <GameController>().gameover();
                //       break;
                // }



                Destroy(gameObject);
            }
            else
            {
                SE2.Play();
                StartCoroutine("Damage");
            }
        }
    }
Пример #2
0
    //起動した際にSEとBGMを流す
    IEnumerator SEE()
    {
        yield return(new WaitForSeconds(1f));

        int i = Random.Range(1, 3);

        if (i == 1)
        {
            SE1.Play();
        }
        else
        {
            SE2.Play();
        }
        yield return(new WaitForSeconds(1f));

        BGM.Play();
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (Main_Scene.isMusicOn)
        {
            if (step == 0)
            {
                myBack.clip = BackGround;
                myBack.Play();
                step = 1;
            }

            if (step == 1)
            {
                if (myBack.isPlaying)
                {
                    if (myBack.time > Looptime)
                    {
                        myBack.time = 0;
                    }

                    myBack.loop   = true;
                    myBack.volume = volume;
                }
            }

            if (SFXCHOOSE)
            {
                for (int i = 0; i < 9; i++)
                {
                    if (SFX[i])
                    {
                        SE.clip = sfx[i];
                        SE.Play();
                        SE.loop   = false;
                        SE.volume = SE_volume;
                    }

                    SFX[i] = false;
                }

                SFXCHOOSE = false;
            }

            if (SFXCHOOSE2)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (SFX2[j])
                    {
                        SE2.clip = sfx2[j];
                        SE2.Play();
                        SE2.loop   = false;
                        SE2.volume = SE2_volume;
                    }

                    SFX2[j] = false;
                }

                SFXCHOOSE = false;
            }

            if (Clocking)
            {
                Clock.clip = tictok;
                Clock.Play();
                Clock.volume = 1.5f;
                Clock.loop   = true;
                Clocking     = false;
            }

            if (ClockingOff)
            {
                Clock.Pause();
                Clock.time  = 0;
                ClockingOff = false;
            }

            if ((Card.FadeOut) && (Main_Scene.Last_Stage > 0))
            {
                if (myBack.isPlaying)
                {
                    if ((!Main_Scene.Player1Mode) && (Main_Scene.Player_1_WinCount > ((Main_Scene.Player_1_WinCount + Main_Scene.Player_2_WinCount + Main_Scene.Last_Stage) / 2) || Main_Scene.Player_2_WinCount > ((Main_Scene.Player_1_WinCount + Main_Scene.Player_2_WinCount + Main_Scene.Last_Stage) / 2)) && (Card.step >= 1))
                    {
                        Destroy(Button_Script.GameMusic);
                    }

                    else
                    {
                        DontDestroyOnLoad(Button_Script.GameMusic);
                    }
                }
            }

            if ((Card.FadeOut) && (Main_Scene.Last_Stage == 0) && (Card.step >= 1))
            {
                if (myBack.isPlaying)
                {
                    Destroy(Button_Script.GameMusic);
                }
            }
        }

        else
        {
            myBack.Pause();
            myBack.time = 0;
            step        = 0;
        }
    }