From 045621a077c6f340212598f8f6ba56c3236a944b Mon Sep 17 00:00:00 2001 From: kimura Date: Mon, 12 Jul 2021 15:51:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=B3=E7=8A=B6=E6=85=8B?= =?UTF-8?q?=E3=81=A7=E5=90=B9=E3=81=A3=E9=A3=9B=E3=81=B3=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E3=81=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyGame/Scenes/Cooking/Scripts/Corn.cs | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) 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)