From 998e1a1ec1d434c2b932f12c868b7b642f5a7b2d Mon Sep 17 00:00:00 2001 From: kimura Date: Mon, 14 Feb 2022 17:51:56 +0900 Subject: [PATCH] =?UTF-8?q?=E7=95=91=E6=BC=94=E5=87=BA=E4=B8=AD=E3=81=AB?= =?UTF-8?q?=E3=83=AC=E3=83=99=E3=83=AB=E3=82=A2=E3=83=83=E3=83=97=E6=BC=94?= =?UTF-8?q?=E5=87=BA=E3=81=8C=E5=85=A5=E3=82=89=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/CornField/Scripts/CornField.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs index f2450356..0df5870e 100644 --- a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs +++ b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs @@ -57,13 +57,14 @@ public class CornField : MonoBehaviour private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly Subject resetFertilizerTimer = new Subject(); - private bool isFertilizing; + private readonly BoolReactiveProperty isFertilizing = new BoolReactiveProperty(); // Start is called before the first frame update void Start() { compositeDisposable.AddTo(this); resetFertilizerTimer.AddTo(this); + isFertilizing.AddTo(this); SoundManager.Instance.PlayBGM("bgm_Main"); // データ @@ -88,6 +89,9 @@ public class CornField : MonoBehaviour // ハートゲージがフルかつダイアログが開いていない場合レベルアップ HeartMeter.Instance.FulledHeart + .CombineLatest(isFertilizing, (acc, active) => acc && !active) + .DistinctUntilChanged() + .Where(x => x) .DelaySubscription(TimeSpan.FromSeconds(.4f)) .Subscribe(_ => { @@ -151,13 +155,13 @@ public class CornField : MonoBehaviour { GetRewardDialog.ShowCornFieldDialog(() => { + isFertilizing.Value = true; gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(fertilizerWaitTime + fertilizerDuration).ToBinary(); #if UNITY_EDITOR gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(10 + fertilizerDuration).ToBinary(); #endif GameDataManager.SaveGameData(); - isFertilizing = true; additionView.IsStopDisapper = true; SoundManager.Instance.PlayBGM("bgm_fertilizer"); brotherFertilizerAnimation.StartAnimation(); @@ -196,7 +200,7 @@ public class CornField : MonoBehaviour this.CallWaitForSeconds(fertilizerFinishWaitTime, () => { - isFertilizing = false; + isFertilizing.Value = false; additionView.IsStopDisapper = false; additionView.PlayEffect(); // ボタン表示復活