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

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解除
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)