演出組み込み
This commit is contained in:
parent
09abcff7aa
commit
faa5e8f569
|
|
@ -66,7 +66,7 @@ public class Corn : MonoBehaviour
|
|||
this.ObserveEveryValueChanged(x => x.rigidbody.velocity.magnitude)
|
||||
.Where(x => x >= cornSpillSpeed)
|
||||
.ThrottleFirstFrame(30) // 30フレーム間隔開ける
|
||||
.Select(_ => Random.value < .2f) // 演出を出す確率
|
||||
.Where(_ => Random.value < .2f) // 演出を出す確率
|
||||
.FirstOrDefault()
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class CornManager : MonoBehaviour
|
|||
private bool isHot;
|
||||
private bool isCompleted;
|
||||
private readonly List<IObservable<CornCondition>> cornConditions = new List<IObservable<CornCondition>>();
|
||||
private readonly Subject<CornCondition> cornSpilledSubject = new Subject<CornCondition>();
|
||||
private readonly Subject<(CornCondition cond, Vector3 pos)> cornSpilledSubject = new Subject<(CornCondition, Vector3)>();
|
||||
private readonly ReactiveProperty<int> missCount = new ReactiveProperty<int>();
|
||||
private readonly ReactiveProperty<float> cornGrowSpeed = new FloatReactiveProperty(0f);
|
||||
private readonly CompositeDisposable compositeDisposable = new CompositeDisposable();
|
||||
|
|
@ -72,13 +72,13 @@ public class CornManager : MonoBehaviour
|
|||
// コーン飛び出し制御
|
||||
// 5フレームごとに2回など演出の回数を制御
|
||||
cornSpilledSubject
|
||||
.Where(x => x != CornCondition.Seed) // Seedは演出なし
|
||||
.Where(x => x.cond != CornCondition.Seed) // Seedは演出なし
|
||||
.BatchFrame(5, FrameCountType.EndOfFrame) // 指定フレーム分まとめる
|
||||
.Subscribe(x =>
|
||||
{
|
||||
foreach (var condition in x.RandomChoose(2))
|
||||
foreach (var item in x.RandomChoose(2))
|
||||
{
|
||||
SpawnSpilledAnimation(condition);
|
||||
SpawnSpilledAnimation(item.cond, item.pos);
|
||||
}
|
||||
}).AddTo(this);
|
||||
|
||||
|
|
@ -192,11 +192,7 @@ public class CornManager : MonoBehaviour
|
|||
}).AddTo(compositeDisposable);
|
||||
|
||||
corn.Spilled
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
// 同時に飛び出したとき用に演出をばらつかせる
|
||||
corn.CallWaitForSeconds(Random.Range(0f, .5f), () => cornSpilledSubject.OnNext(corn.Condition.Value));
|
||||
}).AddTo(compositeDisposable);
|
||||
.Subscribe(_ => cornSpilledSubject.OnNext((corn.Condition.Value, corn.transform.position))).AddTo(compositeDisposable);
|
||||
|
||||
cornConditions.Add(corn.Condition);
|
||||
}
|
||||
|
|
@ -246,10 +242,8 @@ public class CornManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private void SpawnSpilledAnimation(CornCondition condition)
|
||||
private void SpawnSpilledAnimation(CornCondition condition, Vector3 position)
|
||||
{
|
||||
// Result表示より下の範囲にランダム表示
|
||||
var position = new Vector2((Random.value * 2 - 1) * worldWidth, Mathf.Lerp(-worldHeight, maxSpilledHeight, Random.value));
|
||||
// 画面KO再生
|
||||
var animation = Instantiate(spilledCornAnimationPrefab, position, Quaternion.identity);
|
||||
// KOコーンスキン変更
|
||||
|
|
|
|||
Loading…
Reference in New Issue