コーン状態で吹っ飛び条件分け

This commit is contained in:
kimura 2021-07-12 15:51:04 +09:00
parent 25aeecbb32
commit 045621a077
1 changed files with 22 additions and 16 deletions

View File

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