diff --git a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs index 77b571f1..1cf56902 100644 --- a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs +++ b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornField.cs @@ -50,26 +50,21 @@ public class CornField : MonoBehaviour private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly Subject resetFertilizerTimer = new Subject(); + private bool isFertilizing; // Start is called before the first frame update void Start() { compositeDisposable.AddTo(this); resetFertilizerTimer.AddTo(this); -#if UNITY_EDITOR - this.UpdateAsObservable() - .Where(_ => Input.GetKeyDown(KeyCode.R)) - .Take(1) - .Subscribe(_ => TransitionManager.Instance.LoadScene(GameScenes.CornField)).AddTo(this); -#endif - + SoundManager.Instance.PlayBGM("bgm_Main"); // データ var gameData = GameDataManager.GameData; CoinManager.Instance.ChangeCoin(gameData.Coin); HeartMeter.Instance.Initialize(gameData.ViewedShopLevel, gameData.Heart); GameDataObserver.Instance.ShopLevelUpdate - .Where(x => x) + .Where(x => x && !isFertilizing) .Subscribe(x => { LocalCacheManager.Save(ShopLevelUp.DataTag, gameData.ViewedShopLevel + 1); @@ -102,6 +97,7 @@ public class CornField : MonoBehaviour #endif GameDataManager.SaveGameData(); + isFertilizing = true; SoundManager.Instance.PlayBGM("bgm_fertilizer"); brotherFertilizerAnimation.StartAnimation(); // button非表示 @@ -151,6 +147,7 @@ public class CornField : MonoBehaviour this.CallWaitForSeconds(fertilizerFinishWaitTime, () => { + isFertilizing = false; // ボタン表示復活 fertilizerButtonView.gameObject.SetActive(true); promoteGrowthButton.gameObject.SetActive(true); diff --git a/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs b/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs index cce00c8a..6afccd84 100644 --- a/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs +++ b/popcorn/Assets/MyGame/Scripts/GameDataObserver.cs @@ -38,6 +38,7 @@ public class GameDataObserver : SingletonMonoBehaviour Observable.Interval(TimeSpan.FromSeconds(x)) .Select(_ => UnityEngine.SceneManagement.SceneManager.sceneCount) .DistinctUntilChanged() + .Delay(TimeSpan.FromSeconds(.4f)) // .Do(c => { Debug.Log($"sceneCount:{c}");}) ) .Switch();