From 9a3089a4f6507fb31838ce780a9a12ab4ab32fc4 Mon Sep 17 00:00:00 2001 From: kimura Date: Tue, 14 Dec 2021 13:38:45 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A9=A6=E9=A3=9F=E3=81=A8=E5=AE=A3=E4=BC=9D?= =?UTF-8?q?=E3=81=AE=E6=8E=92=E4=BB=96=E5=88=B6=E5=BE=A1=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/marketing/Scripts/CustomerFlow.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs index f123b44a..60b95341 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs @@ -23,6 +23,9 @@ public class CustomerFlow : MonoBehaviour [Header("試食のお客さん出現間隔(秒)")] [SerializeField] private float tastingCustomerInterval = 5f; + public float TastingCustomerInterval => tastingCustomerInterval; + private int adActiveCount = 0; + public IObservable Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, tastingCustomerObservable); private void Awake() @@ -66,8 +69,11 @@ public class CustomerFlow : MonoBehaviour } #endif // 試食 + // tastingCustomerInterval毎にTastingCountを確認 var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval)) - .Where(_ => GameDataManager.GameData.TastingCount > 0) + .Where(_ => adActiveCount <= 0) // 宣伝中判定 + .Where(_ => GameDataManager.GameData.ShopStock.Count > 0) // 在庫ゼロ判定 + .Where(_ => GameDataManager.GameData.TastingCount > 0) // 試食残り判定 .Publish() .RefCount(); // 試食残りカウントを減らす @@ -84,8 +90,10 @@ public class CustomerFlow : MonoBehaviour { var timerObservable = AdWalkerTimer().Publish().RefCount(); adStartObservable.OnNext(timerObservable); + adActiveCount++; timerObservable.Subscribe(_ => { }, () => { + adActiveCount--; onComplete?.Invoke(); }).AddTo(this); }