diff --git a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs index 3d0d7946..988f9609 100644 --- a/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs +++ b/popcorn/Assets/MyGame/Scenes/Cooking/Scripts/Corn.cs @@ -142,16 +142,20 @@ public class Corn : MonoBehaviour // フライパンに追従しないようにparent解除 transform.parent = null; - Observable.Timer(TimeSpan.FromSeconds(Random.Range(.5f, .9f))).Subscribe(_ => + switch (prevCondition) { - Destroy(gameObject); - switch (prevCondition) - { - case CornCondition.Seed: - VibrationManager.Instance.PlayVibrationOnce(); - break; - case CornCondition.Simple: - case CornCondition.Burnt: + case CornCondition.Seed: + VibrationManager.Instance.PlayVibrationOnce(); + Observable.Timer(TimeSpan.FromSeconds(.5f)).Subscribe(_ => + { + Destroy(gameObject); + }).AddTo(this); + break; + case CornCondition.Simple: + case CornCondition.Burnt: + Observable.Timer(TimeSpan.FromSeconds(Random.Range(.3f, .5f))).Subscribe(_ => + { + Destroy(gameObject); // 画面KO再生(同時飛び出し時ランダム) var animation = Instantiate(spilledCornAnimationPrefab, new Vector2(Random.value * worldWidth * 2 - worldWidth, Random.value * 2 * 2 - 2), Quaternion.identity); VibrationManager.Instance.PlayVibrationOnce(); @@ -159,13 +163,15 @@ public class Corn : MonoBehaviour { Destroy(animation); }); - break; - case CornCondition.Spilled: - break; - default: - throw new ArgumentOutOfRangeException(nameof(prevCondition), prevCondition, null); - } - }).AddTo(this); + }).AddTo(this); + + break; + case CornCondition.Spilled: + break; + default: + throw new ArgumentOutOfRangeException(nameof(prevCondition), prevCondition, null); + } + } public void SetCornProperty(float popTime, float burntDuration, float spillSpeed, float popSpeed)