カウンターを肥料演出に対応

This commit is contained in:
kimura 2021-10-29 17:13:11 +09:00
parent 376d3713a4
commit c19d676afa
2 changed files with 5 additions and 1 deletions

View File

@ -118,6 +118,7 @@ public class CornField : MonoBehaviour
GameDataManager.SaveGameData(); GameDataManager.SaveGameData();
isFertilizing = true; isFertilizing = true;
additionView.IsStopDisapper = true;
SoundManager.Instance.PlayBGM("bgm_fertilizer"); SoundManager.Instance.PlayBGM("bgm_fertilizer");
brotherFertilizerAnimation.StartAnimation(); brotherFertilizerAnimation.StartAnimation();
// button非表示 // button非表示
@ -167,6 +168,8 @@ public class CornField : MonoBehaviour
this.CallWaitForSeconds(fertilizerFinishWaitTime, () => this.CallWaitForSeconds(fertilizerFinishWaitTime, () =>
{ {
isFertilizing = false; isFertilizing = false;
additionView.IsStopDisapper = false;
additionView.PlayEffect();
// ボタン表示復活 // ボタン表示復活
promoteGrowthButton.gameObject.SetActive(true); promoteGrowthButton.gameObject.SetActive(true);
sideButtons.SetActive(true); sideButtons.SetActive(true);

View File

@ -20,6 +20,7 @@ public class HarvestedAdditionView : MonoBehaviour
[SerializeField] private float countDuration = .4f; [SerializeField] private float countDuration = .4f;
[Tooltip("コーンが来なくなってから待つ時間")] [Tooltip("コーンが来なくなってから待つ時間")]
[SerializeField] private float waitDisappeared = 2f; [SerializeField] private float waitDisappeared = 2f;
public bool IsStopDisapper;
private static readonly string harvestedCountFormat = "{0}"; private static readonly string harvestedCountFormat = "{0}";
private static readonly string hasCountFormat = "{0}"; private static readonly string hasCountFormat = "{0}";
private readonly Subject<Unit> playEffectObserve = new Subject<Unit>(); private readonly Subject<Unit> playEffectObserve = new Subject<Unit>();
@ -59,11 +60,11 @@ public class HarvestedAdditionView : MonoBehaviour
}).AddTo(this); }).AddTo(this);
playEffectObserve playEffectObserve
.Throttle(TimeSpan.FromSeconds(waitDisappeared)) .Throttle(TimeSpan.FromSeconds(waitDisappeared))
.Where(_ => !IsStopDisapper)
.Subscribe(_ => .Subscribe(_ =>
{ {
endObservable.OnNext(latestCount); endObservable.OnNext(latestCount);
SetHarvestedCount(0); SetHarvestedCount(0);
Debug.Log($"corn:{GameDataManager.GameData.CornSeed} {latestCount}");
disapperCoroutine = this.CallWaitForSeconds(countDuration, () => disapperCoroutine = this.CallWaitForSeconds(countDuration, () =>
{ {
Reset(); Reset();