diff --git a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/Basket.cs b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/Basket.cs index 69b84c76..1f6b0a84 100644 --- a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/Basket.cs +++ b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/Basket.cs @@ -4,7 +4,6 @@ public class Basket : MonoBehaviour { private void OnTriggerExit2D(Collider2D other) { - Debug.Log("exit"); Destroy(other.gameObject, 2f); } } diff --git a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornHarvester.cs b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornHarvester.cs index c5d55db2..be1b931d 100644 --- a/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornHarvester.cs +++ b/popcorn/Assets/MyGame/Scenes/CornField/Scripts/CornHarvester.cs @@ -12,6 +12,7 @@ public class CornHarvester : MonoBehaviour [SerializeField] private GameObject harvestedPrefab; [SerializeField] private float thrust = 100f; private float duration = .5f; + private int maxCorn = 100; // 収穫演出で出るコーンの数を制限 private string counterFormat = "{0}"; private Coroutine animationCoroutine; @@ -21,14 +22,18 @@ public class CornHarvester : MonoBehaviour { count.AddTo(this); cornCounter.text = "0"; - count.BatchFrame().Select(x => x.Sum()).Pairwise().Subscribe(x => + count + .BatchFrame() + .Select(x => x.Last()) + .Pairwise() + .Subscribe(x => { this.SafeStopCoroutine(animationCoroutine); animationCoroutine = this.CallLerpSmooth(duration, lerp => { cornCounter.text = string.Format(counterFormat, (int)Mathf.Lerp(x.Previous, x.Current, lerp)); }); - StartCoroutine(Harvested(x.Current - x.Previous)); + StartCoroutine(Harvested(Mathf.Min(maxCorn, x.Current - x.Previous))); }).AddTo(this); }