예제 #1
0
    // Update is called once per frame
    void Update()
    {
        // まだ宝を取得していない
        if (isSuccess == false)
        {
            // 宝を見続けている
            if (gaugeSwitch == true)
            {
                // 円ゲージを増加させる
                c_guageImage.fillAmount += 1.0f / fullGaugeTime * Time.deltaTime;

                // 円ゲージが0以下の時お宝取得(複数取得させないようにする)
                if (c_guageImage.fillAmount >= 1.0f && isSuccess == false)
                {
                    Debug.Log("FullGauge");
                    // 複数取得させない
                    isSuccess = true;

                    // サウンド再生
                    audioSource.PlayOneShot(seSelect);

                    //========================================================
                    // 成功処理
                    //========================================================
                    // シーン遷移があれば...
                    if (string.IsNullOrEmpty(loadSceneName) == false)
                    {
                        // テキスト変更
                        c_guageText.text = "NowLoading...";
                        // 1.0秒後にシーン遷移
                        StartCoroutine(DelayMethod(loadSceneWaitTime, () => {
                            SceneManager.LoadScene(loadSceneName);
                        }));
                    }
                    else if (loadSceneName == "GameEnd")                        // ゲーム終了処理
                    // テキスト変更
                    {
                        c_guageText.text = "お疲れ様でした";
                        // 指定時間後にゲームを終了する
                        StartCoroutine(DelayMethod(loadSceneWaitTime, () => {
                            Application.Quit();
                        }));
                    }
                    else if (Application.loadedLevelName == "ShivaT84_MainScene")
                    {
                        // Player.csの関数を呼び出す
                        playerComponent.GameStartSwitchOn();
                    }

                    if (isButton == false)
                    {
                        // テキストをアクティブに設定して表示
                        child_GuageText.gameObject.SetActive(true);
                    }
                    // 指定時間後に削除
                    Destroy(gameObject, destroyTime);
                }
            }
        }
    }