From 3ba046e754e821cfa3b47b6720bce026059eb9cc Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 4 Feb 2022 16:48:59 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BB=E3=83=AC=E3=83=96=E7=94=A8Flow?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/CustomerFlow.cs | 23 ++++++++++++++++++- .../MyGame/Scenes/marketing/Scripts/Market.cs | 5 ++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs index 60b95341..fe48a028 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerFlow.cs @@ -9,6 +9,8 @@ public class CustomerFlow : MonoBehaviour private IObservable walkerObservable; private IObservable adWalkerObservable; private readonly Subject> adStartObservable = new Subject>(); + private IObservable vipCustomerObservable; + private readonly Subject> vipCustomerSubject = new Subject>(); private IObservable tastingCustomerObservable; private static readonly float checkHeartInterval = 1f; @@ -19,6 +21,11 @@ public class CustomerFlow : MonoBehaviour [SerializeField] private float adWalkerDuration = 60f; [Header("宣伝で来るお客さんの数")] [SerializeField] private int adWalkerCount = 20; + + [Header("VIP宣伝で来るお客さんの数")] + [SerializeField] private int vipCustomerCount = 6; + [Header("VIP宣伝で来るお客さん出現間隔(秒)")] + [SerializeField] private float vipCustomerInterval = 5f; [Header("試食のお客さん出現間隔(秒)")] [SerializeField] private float tastingCustomerInterval = 5f; @@ -26,11 +33,12 @@ public class CustomerFlow : MonoBehaviour public float TastingCustomerInterval => tastingCustomerInterval; private int adActiveCount = 0; - public IObservable Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, tastingCustomerObservable); + public IObservable Flow => walkerObservable.Merge(customerObservable, adWalkerObservable, vipCustomerObservable, tastingCustomerObservable); private void Awake() { adStartObservable.AddTo(this); + vipCustomerSubject.AddTo(this); var shopLevelList = SpreadsheetDataManager.Instance.GetBaseDataList(Const.ShopLevelDataSheet); shopLevelList = shopLevelList.Where(data => data.shopLevel != Const.SpecialShopLevel).ToList(); @@ -68,6 +76,12 @@ public class CustomerFlow : MonoBehaviour // Observable.Timer(TimeSpan.FromSeconds(1f), TimeSpan.FromSeconds(70f)).Subscribe(_ => { adStartObservable.OnNext(default); }).AddTo(this); } #endif + + // VIP宣伝 + vipCustomerObservable = vipCustomerSubject + .Switch() + .Select(_ => true); + // 試食 // tastingCustomerInterval毎にTastingCountを確認 var tastingTimer = Observable.Interval(TimeSpan.FromSeconds(tastingCustomerInterval)) @@ -104,4 +118,11 @@ public class CustomerFlow : MonoBehaviour .Take(TimeSpan.FromSeconds(adWalkerDuration)) .AsUnitObservable(); } + + public void StartVip() + { + vipCustomerSubject.OnNext(Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(vipCustomerInterval)) + .Take(vipCustomerCount) + .AsUnitObservable()); + } } diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index 70d6017c..699bf550 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -540,6 +540,11 @@ public class Market : SingletonMonoBehaviour }); } + public void VipAction() + { + customerFlow.StartVip(); + } + public CustomerController SetTutorialCustomer() { var customerController = SpawnCustomer();