From 1448403674928d02fb4001f2597f3148a7ed9c05 Mon Sep 17 00:00:00 2001 From: kimura Date: Fri, 15 Oct 2021 19:50:57 +0900 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86=E3=82=B7?= =?UTF-8?q?=E3=83=BC=E3=83=B3=E8=A1=A8=E7=A4=BA=E4=B8=AD=E3=81=AF=E3=81=8A?= =?UTF-8?q?=E5=AE=A2=E3=81=95=E3=82=93=E3=81=AE=E7=94=9F=E6=88=90=E3=81=A8?= =?UTF-8?q?=E5=8B=95=E3=81=8D=E3=82=92=E6=AD=A2=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scenes/marketing/Scripts/CustomerController.cs | 5 +++++ .../Assets/MyGame/Scenes/marketing/Scripts/Market.cs | 11 +++++++++++ .../Scenes/marketing/Scripts/ProductManagement.cs | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs index 1888930d..8afb7349 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/CustomerController.cs @@ -34,6 +34,7 @@ public class CustomerController : MonoBehaviour public int OrderCount; public CustomerAnimator CustomerPrefab; public bool IsCustomer; + public bool IsPause; // 歩道の幅(min,max) [SerializeField] private float walkSideTopPosition; @@ -102,6 +103,10 @@ public class CustomerController : MonoBehaviour }).AddTo(this); this.UpdateAsObservable().Subscribe(_ => { + if (IsPause) + { + return; + } var localPosition = transform.localPosition; localPosition = Vector2.MoveTowards(localPosition, wayPoint, speed * Time.deltaTime); localPosition = localPosition + Vector3.forward * (localPosition.y + Mathf.Abs(walkSideBottomPos)); diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs index 3c6d597e..0d6b3ead 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/Market.cs @@ -38,6 +38,7 @@ public class Market : SingletonMonoBehaviour private readonly Subject requestSubject = new Subject(); private readonly ReactiveCollection waitCustomerList = new ReactiveCollection(); private readonly Subject orderSubject = new Subject(); + public readonly BoolReactiveProperty IsPause = new BoolReactiveProperty(false); public Subject SellObservable => sellObservable; private readonly Subject sellObservable = new Subject(); @@ -57,6 +58,7 @@ public class Market : SingletonMonoBehaviour waitCustomerList.AddTo(this); requestSubject.AddTo(this); orderSubject.AddTo(this); + IsPause.AddTo(this); var gameData = GameDataManager.GameData; @@ -247,6 +249,10 @@ public class Market : SingletonMonoBehaviour customerFlow.Flow.Subscribe(isCustomer => { + if (IsPause.Value) + { + return; + } // 一般客orセレブ var (isSpecial, orderCount) = GetCustomerData(isCustomer); @@ -266,6 +272,11 @@ public class Market : SingletonMonoBehaviour customerController.OrderCount = orderCount; customerController.CustomerPrefab = prefab; customerControllerList.Add(customerController); + + IsPause.Subscribe(x => + { + customerController.IsPause = x; + }).AddTo(customerController); customerController.MoveEndObservable .SkipLatestValueOnSubscribe() diff --git a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs index 652d1512..dc1e5438 100644 --- a/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs +++ b/popcorn/Assets/MyGame/Scenes/marketing/Scripts/ProductManagement.cs @@ -22,6 +22,8 @@ public class ProductManagement : MonoBehaviour { state.AddTo(this); state.Value = ManagementState.None; + + Market.Instance.IsPause.Value = true; var gameData = GameDataManager.GameData; CoinManager.Instance.ChangeCoin(gameData.Coin); HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart); @@ -269,4 +271,9 @@ public class ProductManagement : MonoBehaviour GameDataManager.SaveGameData(); // 試食フラグに終了時間を設定 } + + private void OnDestroy() + { + Market.Instance.IsPause.Value = false; + } }