public void OnclickResetButton()//
 {
     if (testgm == null)
     {
         testgm = GameObject.Find("GameManager").GetComponent <Testgm>();
     }
     testgm.Reset();
 }
Beispiel #2
0
    void Update()
    {
        switch (state)
        {
        case GameState.Title:
            kamifubuki.SetActive(false);
            TitleArrive();
            Time.timeScale = 1;
            break;

        case GameState.Game:
            operationflg = false;
            buttonui.SetActive(true);
            Time.timeScale = 1;
            if (oldState != state)
            {
                break;
            }
            if (player2 == null)
            {
                player2 = GameObject.Find("Player").GetComponent <Player2>();
            }
            if (boumanager2 == null)
            {
                boumanager2 = GameObject.Find("BouManager").GetComponent <BouManager2>();
            }

            if (player2.IsGameOver() || boumanager2.IsGameOver())
            {
                state = GameState.Gameover;
                GameObject.Find("GameOverText").GetComponent <Text>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
            }

            if (boumanager2.IsClear())
            {
                audiosource.PlayOneShot(clearsound);
                state = GameState.Gameclear;
                kamifubuki.SetActive(true);
                GameObject.Find("GameClearText").GetComponent <Text>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
            }
            break;

        case GameState.Gameclear:
            Invoke("InvokeOperation", 1.5f);
            Time.timeScale = 1;
            if (Input.GetMouseButton(0) && operationflg == true)
            {
                if (testgm == null)
                {
                    testgm = Testgm.instance;
                }
                if (testgm.NextStage() == -1)
                {
                    SceneManager.LoadScene("Endroll");    //最終ステージクリア
                }

                kamifubuki.SetActive(false);
                operationflg = false;
            }
            break;

        case GameState.Gameover:

            buttonui.SetActive(false);
            Invoke("InvokeOperation", 0.25f);
            Time.timeScale = 0.1f;
            //gameoverui.SetActive(true);
            if (Input.GetMouseButton(0) && operationflg == true)

            {
                if (testgm == null)
                {
                    testgm = Testgm.instance;
                }
                testgm.Reset();
                state        = GameState.Title;
                operationflg = false;
            }
            break;
        }
        oldState        = state;
        oldMouseButton0 = Input.GetMouseButton(0);
    }