畑演出中にレベルアップ演出が入らないようにした

This commit is contained in:
kimura 2022-02-14 17:51:56 +09:00
parent f1d0e27e5e
commit 998e1a1ec1
1 changed files with 7 additions and 3 deletions

View File

@ -57,13 +57,14 @@ public class CornField : MonoBehaviour
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable(); private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
private readonly Subject<int> resetFertilizerTimer = new Subject<int>(); private readonly Subject<int> resetFertilizerTimer = new Subject<int>();
private bool isFertilizing; private readonly BoolReactiveProperty isFertilizing = new BoolReactiveProperty();
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
compositeDisposable.AddTo(this); compositeDisposable.AddTo(this);
resetFertilizerTimer.AddTo(this); resetFertilizerTimer.AddTo(this);
isFertilizing.AddTo(this);
SoundManager.Instance.PlayBGM("bgm_Main"); SoundManager.Instance.PlayBGM("bgm_Main");
// データ // データ
@ -88,6 +89,9 @@ public class CornField : MonoBehaviour
// ハートゲージがフルかつダイアログが開いていない場合レベルアップ // ハートゲージがフルかつダイアログが開いていない場合レベルアップ
HeartMeter.Instance.FulledHeart HeartMeter.Instance.FulledHeart
.CombineLatest(isFertilizing, (acc, active) => acc && !active)
.DistinctUntilChanged()
.Where(x => x)
.DelaySubscription(TimeSpan.FromSeconds(.4f)) .DelaySubscription(TimeSpan.FromSeconds(.4f))
.Subscribe(_ => .Subscribe(_ =>
{ {
@ -151,13 +155,13 @@ public class CornField : MonoBehaviour
{ {
GetRewardDialog.ShowCornFieldDialog(() => GetRewardDialog.ShowCornFieldDialog(() =>
{ {
isFertilizing.Value = true;
gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(fertilizerWaitTime + fertilizerDuration).ToBinary(); gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(fertilizerWaitTime + fertilizerDuration).ToBinary();
#if UNITY_EDITOR #if UNITY_EDITOR
gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(10 + fertilizerDuration).ToBinary(); gameData.fertilizerTime = DateTime.UtcNow.AddSeconds(10 + fertilizerDuration).ToBinary();
#endif #endif
GameDataManager.SaveGameData(); GameDataManager.SaveGameData();
isFertilizing = true;
additionView.IsStopDisapper = true; additionView.IsStopDisapper = true;
SoundManager.Instance.PlayBGM("bgm_fertilizer"); SoundManager.Instance.PlayBGM("bgm_fertilizer");
brotherFertilizerAnimation.StartAnimation(); brotherFertilizerAnimation.StartAnimation();
@ -196,7 +200,7 @@ public class CornField : MonoBehaviour
this.CallWaitForSeconds(fertilizerFinishWaitTime, () => this.CallWaitForSeconds(fertilizerFinishWaitTime, () =>
{ {
isFertilizing = false; isFertilizing.Value = false;
additionView.IsStopDisapper = false; additionView.IsStopDisapper = false;
additionView.PlayEffect(); additionView.PlayEffect();
// ボタン表示復活 // ボタン表示復活